Preserve cancellation after profile lookups

This commit is contained in:
2026-08-25 02:06:47 +00:00
parent 67f788b1e2
commit 3d99483219
2 changed files with 26 additions and 2 deletions

View File

@@ -321,6 +321,19 @@ func TestResolvingRepositoryIsFreshAndCancellationAware(t *testing.T) {
t.Fatalf("base calls after cancellation = %d, want 2", got)
}
terminalLookup, cancelTerminalLookup := context.WithCancel(context.Background())
repo.afterGet = func(id string) {
if id == "base" {
cancelTerminalLookup()
}
}
if _, err := resolver.GetProfile(terminalLookup, "leaf"); !errors.Is(err, context.Canceled) {
t.Fatalf("terminal lookup cancellation error = %v", err)
}
if got := repo.callCount("base"); got != 3 {
t.Fatalf("base calls after terminal cancellation = %d, want 3", got)
}
repo.afterGet = nil
var wg sync.WaitGroup
errors := make(chan error, 8)