Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions internal/adapter/firecracker/egress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"errors"
"log/slog"
"runtime"
"strings"
"testing"

Expand Down Expand Up @@ -110,6 +111,12 @@ func TestTranslate_SanitizesTableName(t *testing.T) {
// touching the kernel. Linux integration tests live in
// egress_linux_integration_test.go and are gated on root + GOOS=linux.
func TestApplyEgressRules_FallbackBehavior(t *testing.T) {
if runtime.GOOS == "linux" {
// On Linux applyEgressRules hits the real nftables path, which needs
// CAP_NET_ADMIN. CI runners don't have it; Linux-specific coverage
// lives in egress_linux_test.go behind a root-only gate.
t.Skip("Linux path exercises real nftables; see egress_linux_test.go")
}
var buf bytes.Buffer
log := slog.New(slog.NewTextHandler(&buf, &slog.HandlerOptions{Level: slog.LevelDebug}))

Expand Down
14 changes: 7 additions & 7 deletions internal/cli/login_github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"net/http"
"net/http/httptest"
"path/filepath"
Expand Down Expand Up @@ -196,18 +197,17 @@ func TestPollForGitHubToken_Cancel(t *testing.T) {
})
defer gh.server.Close()
ctx, cancel := context.WithCancel(context.Background())
// Cancel almost immediately.
go func() {
time.Sleep(5 * time.Millisecond)
cancel()
}()
// Cancel up-front so the first poll observes ctx.Err() deterministically.
// The previous version raced a sleep-then-cancel goroutine against the
// poll loop and was flaky under loaded CI runners.
cancel()
_, err := pollForGitHubToken(ctx, gh.server.Client(),
gh.server.URL, "id", "DEV", 1*time.Millisecond)
if err == nil {
t.Fatalf("expected error on cancel, got nil")
}
if !strings.Contains(err.Error(), "cancelled") {
t.Fatalf("error should mention cancel; got %v", err)
if !errors.Is(err, context.Canceled) {
t.Fatalf("error should wrap context.Canceled; got %v", err)
}
}

Expand Down
Loading