Preserve cancellation after profile lookups
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user