[PR #15970] registry: add test to verify server logging behavior #77671

Open
opened 2026-05-05 10:20:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15970
Author: @krasilovalex
Created: 5/5/2026
Status: 🔄 Open

Base: mainHead: registry-logging-test


📝 Commits (1)

  • e47482d registry: add test to verify server logging behavior

📊 Changes

2 files changed (+89 additions, -3 deletions)

View changed files

📝 server/internal/registry/server.go (+0 -3)
📝 server/internal/registry/server_test.go (+89 -0)

📄 Description

This PR addresses the TODO(bmizerany) in server/internal/registry/server.go by adding a dedicated test to verify the HTTP logging behavior of the local registry server.

Changes:

  • Added TestServerLoggingBehavior in server_test.go.
  • Utilized existing test utilities (newTestServer and captureLogs) to mock requests and intercept the slog output.
  • Verified that the correct log levels (INFO, WARN, ERROR) are applied based on HTTP status codes (200, 400, 500).
  • Confirmed that essential HTTP attributes (status, method, path, remote, query) are correctly recorded in the logs.
  • Removed the resolved TODO comment from server.go.

All tests pass successfully locally via go test -v ./server/internal/registry/.


🔄 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/15970 **Author:** [@krasilovalex](https://github.com/krasilovalex) **Created:** 5/5/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `registry-logging-test` --- ### 📝 Commits (1) - [`e47482d`](https://github.com/ollama/ollama/commit/e47482d959a5513459c6dcf3791af7adacb04e29) registry: add test to verify server logging behavior ### 📊 Changes **2 files changed** (+89 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `server/internal/registry/server.go` (+0 -3) 📝 `server/internal/registry/server_test.go` (+89 -0) </details> ### 📄 Description This PR addresses the `TODO(bmizerany)` in `server/internal/registry/server.go` by adding a dedicated test to verify the HTTP logging behavior of the local registry server. **Changes:** * Added `TestServerLoggingBehavior` in `server_test.go`. * Utilized existing test utilities (`newTestServer` and `captureLogs`) to mock requests and intercept the `slog` output. * Verified that the correct log levels (`INFO`, `WARN`, `ERROR`) are applied based on HTTP status codes (`200`, `400`, `500`). * Confirmed that essential HTTP attributes (`status`, `method`, `path`, `remote`, `query`) are correctly recorded in the logs. * Removed the resolved `TODO` comment from `server.go`. All tests pass successfully locally via `go test -v ./server/internal/registry/`. --- <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-05-05 10:20:47 -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#77671