mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
test: one context assignment per branch so no cancel is lost
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
399bc7699f
commit
4744b8a4c0
1 file changed
+4
-1
@@ -293,9 +293,12 @@ func TestSyncControlsIgnoreAmbientAllocation(t *testing.T) {
|
||||
// The crash-matrix child is fdatasync-bound and takes 1-35 s on a
|
||||
// slow disk, so it runs until the parent test's deadline rather
|
||||
// than a fixed budget.
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
var ctx context.Context
|
||||
var cancel context.CancelFunc
|
||||
if d, ok := t.Deadline(); ok {
|
||||
ctx, cancel = context.WithDeadline(context.Background(), d.Add(-10*time.Second))
|
||||
} else {
|
||||
ctx, cancel = context.WithCancel(context.Background())
|
||||
}
|
||||
defer cancel()
|
||||
cmd := exec.CommandContext(ctx, os.Args[0], "-test.run=^"+tc.test+"$")
|
||||
|
||||
Reference in new issue
Block a user