mirror of
https://github.com/enix/x509-certificate-exporter.git
synced 2026-08-19 03:56:21 +00:00
test(server): fix codeql warning on return value
This commit is contained in:
@@ -2,6 +2,7 @@ package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
@@ -94,5 +95,9 @@ func TestRunGracefulShutdown(t *testing.T) {
|
||||
defer ts.Close()
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
|
||||
defer cancel()
|
||||
_ = Run(ctx, &http.Server{Addr: "127.0.0.1:0", Handler: srv.Handler}, nopLogger())
|
||||
// Run must return the ctx error after graceful shutdown, not a
|
||||
// server-side error (e.g. bind failure).
|
||||
if err := Run(ctx, &http.Server{Addr: "127.0.0.1:0", Handler: srv.Handler}, nopLogger()); !errors.Is(err, context.DeadlineExceeded) {
|
||||
t.Fatalf("Run: expected context.DeadlineExceeded, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user