[PR #15376] auth, logutil: add unit tests #61827

Open
opened 2026-04-29 16:50:04 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15376
Author: @saaman-mahmoodi
Created: 4/7/2026
Status: 🔄 Open

Base: mainHead: add-tests-auth-logutil


📝 Commits (1)

  • 27c0752 auth, logutil: add unit tests

📊 Changes

2 files changed (+506 additions, -0 deletions)

View changed files

auth/auth_test.go (+289 -0)
logutil/logutil_test.go (+217 -0)

📄 Description

Summary

Adds comprehensive unit test coverage for two previously untested packages:

  • auth: Tests for nonce generation, SSH key parsing, public key extraction, and Ed25519 signing
  • logutil: Tests for logger creation, level filtering, trace-level logging, and source attribution

Test Coverage Added

auth/auth_test.go

  • TestNewNonce: Validates nonce generation, length encoding, uniqueness, and error propagation
  • TestGetPublicKey: Tests error handling for missing keys and valid SSH key extraction
  • TestSign: Tests signing with missing keys, signature format validation, and uniqueness
  • TestSignPublicKeyFormat: Validates Ed25519 signature length

logutil/logutil_test.go

  • TestLevelTrace: Validates trace level constant value
  • TestNewLogger: Tests logger creation, level filtering, trace formatting, and source info
  • TestTrace/TestTraceContext: Tests trace-level logging behavior with context
  • TestLoggerOutput: Validates standard field output and multiple log calls

Testing

All tests pass:

go test ./auth/... ./logutil/... -v

🔄 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/15376 **Author:** [@saaman-mahmoodi](https://github.com/saaman-mahmoodi) **Created:** 4/7/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `add-tests-auth-logutil` --- ### 📝 Commits (1) - [`27c0752`](https://github.com/ollama/ollama/commit/27c0752d7d52e878a8b62d786002d42541e1c982) auth, logutil: add unit tests ### 📊 Changes **2 files changed** (+506 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `auth/auth_test.go` (+289 -0) ➕ `logutil/logutil_test.go` (+217 -0) </details> ### 📄 Description ## Summary Adds comprehensive unit test coverage for two previously untested packages: - **auth**: Tests for nonce generation, SSH key parsing, public key extraction, and Ed25519 signing - **logutil**: Tests for logger creation, level filtering, trace-level logging, and source attribution ## Test Coverage Added ### `auth/auth_test.go` - `TestNewNonce`: Validates nonce generation, length encoding, uniqueness, and error propagation - `TestGetPublicKey`: Tests error handling for missing keys and valid SSH key extraction - `TestSign`: Tests signing with missing keys, signature format validation, and uniqueness - `TestSignPublicKeyFormat`: Validates Ed25519 signature length ### `logutil/logutil_test.go` - `TestLevelTrace`: Validates trace level constant value - `TestNewLogger`: Tests logger creation, level filtering, trace formatting, and source info - `TestTrace`/`TestTraceContext`: Tests trace-level logging behavior with context - `TestLoggerOutput`: Validates standard field output and multiple log calls ## Testing All tests pass: ``` go test ./auth/... ./logutil/... -v ``` --- <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-29 16:50:05 -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#61827