Re-vendor the shared files from sneak/prompts at dd4027b (closes #52)
check / check (push) Waiting to run
check / check (push) Waiting to run
Takes .golangci.yml, .dockerignore, .gitignore, .editorconfig, the workflow and REPO_POLICIES.md from sneak/prompts dd4027b, keeping this repository's own entries after the shared content. Lint (golangci-lint v2.14.0) and test become Dockerfile phases that script/lint and script/test build alone and uncached; the image build depends on both, and script/cibuild bootstraps, runs script/check, then builds the image. The agent guidance file moves to AGENTS.md. The Go code is fixed for what the new configuration finds; reads that iterate rows now also report an iteration error. Model: opus-5-5
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package server
|
||||
package server_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"git.eeqj.de/sneak/routewatch/internal/config"
|
||||
"git.eeqj.de/sneak/routewatch/internal/logger"
|
||||
"git.eeqj.de/sneak/routewatch/internal/metrics"
|
||||
"git.eeqj.de/sneak/routewatch/internal/server"
|
||||
"git.eeqj.de/sneak/routewatch/internal/streamer"
|
||||
)
|
||||
|
||||
@@ -16,18 +17,31 @@ import (
|
||||
// listened in a goroutine, only logged the failure and returned nil, so the
|
||||
// daemon kept running without its web server.
|
||||
func TestStartFailsWhenPortIsHeld(t *testing.T) {
|
||||
held, err := net.Listen("tcp", ":0")
|
||||
t.Parallel()
|
||||
|
||||
var listenConfig net.ListenConfig
|
||||
|
||||
held, err := listenConfig.Listen(t.Context(), "tcp", ":0")
|
||||
if err != nil {
|
||||
t.Fatalf("failed to open the test listener: %v", err)
|
||||
}
|
||||
defer func() { _ = held.Close() }()
|
||||
|
||||
port := held.Addr().(*net.TCPAddr).Port
|
||||
addr, ok := held.Addr().(*net.TCPAddr)
|
||||
if !ok {
|
||||
t.Fatalf("test listener address %v is not a TCP address", held.Addr())
|
||||
}
|
||||
|
||||
port := addr.Port
|
||||
log := logger.New()
|
||||
s := New(nil, streamer.New(log, metrics.New()), log, &config.Config{Port: port})
|
||||
s := server.New(nil, streamer.New(log, metrics.New()), log,
|
||||
&config.Config{Port: port})
|
||||
|
||||
defer func() { _ = s.Stop(context.Background()) }()
|
||||
|
||||
if err := s.Start(); err == nil {
|
||||
t.Fatalf("Start returned nil while port %d was held by another listener", port)
|
||||
err = s.Start(t.Context())
|
||||
if err == nil {
|
||||
t.Fatalf("Start returned nil while port %d was held by another listener",
|
||||
port)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user