[PR #14414] server/internal/registry: test logging contract for serveHTTP #14667

Open
opened 2026-04-13 01:00:22 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14414
Author: @shuv-amp
Created: 2/25/2026
Status: 🔄 Open

Base: mainHead: bmizerany/registry-logging-tests


📝 Commits (1)

  • a93b469 server/internal/registry: test logging contract for serveHTTP

📊 Changes

2 files changed (+130 additions, -4 deletions)

View changed files

📝 server/internal/registry/server.go (+0 -4)
📝 server/internal/registry/server_test.go (+130 -0)

📄 Description

Add TestServerLogging to cover the structured log output and level
selection in serveHTTP. There was a TODO asking for this.

Four subtests exercise the interesting cases:

  • a successful (2xx) request logs at INFO without an error attr
  • a client error (4xx) logs at WARN with the error
  • a server error (5xx) logs at ERROR with the error
  • a proxied fallback request produces no registry log entry

Each subtest uses a fresh server and log buffer. Requests are built
with fixed RemoteAddr, Proto, and ContentLength so assertions stay
stable. The checks use substring matching rather than full-line
snapshots to avoid breaking on timestamp or field-order changes.

Also removes the TODO(bmizerany) at the LogAttrs callsite since this
test now covers it.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/14414 **Author:** [@shuv-amp](https://github.com/shuv-amp) **Created:** 2/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `bmizerany/registry-logging-tests` --- ### 📝 Commits (1) - [`a93b469`](https://github.com/ollama/ollama/commit/a93b469c9e892f005324eed0b88fbe80b7106940) server/internal/registry: test logging contract for serveHTTP ### 📊 Changes **2 files changed** (+130 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `server/internal/registry/server.go` (+0 -4) 📝 `server/internal/registry/server_test.go` (+130 -0) </details> ### 📄 Description Add TestServerLogging to cover the structured log output and level selection in serveHTTP. There was a TODO asking for this. Four subtests exercise the interesting cases: - a successful (2xx) request logs at INFO without an error attr - a client error (4xx) logs at WARN with the error - a server error (5xx) logs at ERROR with the error - a proxied fallback request produces no registry log entry Each subtest uses a fresh server and log buffer. Requests are built with fixed RemoteAddr, Proto, and ContentLength so assertions stay stable. The checks use substring matching rather than full-line snapshots to avoid breaking on timestamp or field-order changes. Also removes the TODO(bmizerany) at the LogAttrs callsite since this test now covers it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 01:00:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#14667