Re-vendor the shared files from sneak/prompts at 0653579 (closes #52)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
Takes .golangci.yml, .dockerignore, .gitignore, .editorconfig, the workflow and REPO_POLICIES.md from sneak/prompts 0653579, with this repository's own entries after the shared content. Lint (golangci-lint v2.14.0) and test are Dockerfile phases that script/lint and script/test build alone with a new CACHEBUST value, keeping Go's and golangci-lint's caches; the image build depends on both. make fmt and make fmt-check also format the markdown with prettier, pinned in yarn.lock. The agent guidance moves to AGENTS.md. The Go code is fixed for what the new configuration finds, and the AS and prefix detail reads now return the rows' error after their loops. Model: opus-5-5
This commit was merged in pull request #85.
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