Skip to content

Commit

Permalink
Merge pull request moby#4921 from tonistiigi/test-sandbox-cancel
Browse files Browse the repository at this point in the history
testutil: make sure context is canceled after test end
  • Loading branch information
tonistiigi authored May 13, 2024
2 parents 9541488 + 89b6379 commit 4bdc49b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions util/testutil/integration/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/moby/buildkit/util/appcontext"
"github.com/moby/buildkit/util/contentutil"
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
"golang.org/x/sync/semaphore"
)
Expand Down Expand Up @@ -197,6 +198,9 @@ func Run(t *testing.T, testCases []Test, opt ...TestOpt) {
require.NoError(t, sandboxLimiter.Acquire(context.TODO(), 1))
defer sandboxLimiter.Release(1)

ctx, cancel := context.WithCancelCause(ctx)
defer cancel(errors.WithStack(context.Canceled))

sb, closer, err := newSandbox(ctx, br, mirror, mv)
require.NoError(t, err)
t.Cleanup(func() { _ = closer() })
Expand Down

0 comments on commit 4bdc49b

Please sign in to comment.