All checks were successful
check / check (push) Successful in 1m0s
Remove the `Buildarch` field from the globals package and all references throughout the codebase. **Changes:** - Removed `Buildarch` package-level var and struct field from `internal/globals/globals.go` - Removed `Buildarch` from the `New()` constructor - Removed `globals.Buildarch = runtime.GOARCH` and unused `runtime` import from `cmd/webhooker/main.go` - Removed `buildarch` from logger startup output in `internal/logger/logger.go` - Removed all `Buildarch` test setup and assertions from globals, logger, database, and webhook_db_manager tests All tests pass, `make check` passes, `docker build .` succeeds. closes [issue #30](#30) <!-- session: agent:sdlc-manager:subagent:5cae6803-6bdf-467d-9a56-43f135521e5f --> Co-authored-by: clawbot <clawbot@noreply.git.eeqj.de> Reviewed-on: #31 Co-authored-by: clawbot <clawbot@noreply.example.org> Co-committed-by: clawbot <clawbot@noreply.example.org>
64 lines
1.1 KiB
Go
64 lines
1.1 KiB
Go
package logger
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"go.uber.org/fx/fxtest"
|
|
"sneak.berlin/go/webhooker/internal/globals"
|
|
)
|
|
|
|
func TestNew(t *testing.T) {
|
|
// Set up globals
|
|
globals.Appname = "test-app"
|
|
globals.Version = "1.0.0"
|
|
|
|
lc := fxtest.NewLifecycle(t)
|
|
g, err := globals.New(lc)
|
|
if err != nil {
|
|
t.Fatalf("globals.New() error = %v", err)
|
|
}
|
|
|
|
params := LoggerParams{
|
|
Globals: g,
|
|
}
|
|
|
|
logger, err := New(lc, params)
|
|
if err != nil {
|
|
t.Fatalf("New() error = %v", err)
|
|
}
|
|
|
|
if logger.Get() == nil {
|
|
t.Error("Get() returned nil logger")
|
|
}
|
|
|
|
// Test that we can log without panic
|
|
logger.Get().Info("test message", "key", "value")
|
|
}
|
|
|
|
func TestEnableDebugLogging(t *testing.T) {
|
|
// Set up globals
|
|
globals.Appname = "test-app"
|
|
globals.Version = "1.0.0"
|
|
|
|
lc := fxtest.NewLifecycle(t)
|
|
g, err := globals.New(lc)
|
|
if err != nil {
|
|
t.Fatalf("globals.New() error = %v", err)
|
|
}
|
|
|
|
params := LoggerParams{
|
|
Globals: g,
|
|
}
|
|
|
|
logger, err := New(lc, params)
|
|
if err != nil {
|
|
t.Fatalf("New() error = %v", err)
|
|
}
|
|
|
|
// Enable debug logging should not panic
|
|
logger.EnableDebugLogging()
|
|
|
|
// Test debug logging
|
|
logger.Get().Debug("debug message", "test", true)
|
|
}
|