From e344f3a4f6d9c77397cb998248d93c989bf86928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Tue, 28 Feb 2023 10:51:46 +0100 Subject: [PATCH] test/client: Close buildkit client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes hang in these tests which caused a timeout. Signed-off-by: Paweł Gronowski (cherry picked from commit 3b0aa6949de9857e4209844ee0bc3fd31cebe490) --- client/client_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/client_test.go b/client/client_test.go index 0fca38e23a70..b97eb75f274b 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -7160,11 +7160,13 @@ func testExportAttestations(t *testing.T, sb integration.Sandbox) { requiresLinux(t) c, err := New(sb.Context(), sb.Address()) require.NoError(t, err) + defer c.Close() registry, err := sb.NewRegistry() if errors.Is(err, integration.ErrRequirements) { t.Skip(err.Error()) } + require.NoError(t, err) ps := []ocispecs.Platform{ platforms.MustParse("linux/amd64"), @@ -7480,11 +7482,13 @@ func testAttestationDefaultSubject(t *testing.T, sb integration.Sandbox) { requiresLinux(t) c, err := New(sb.Context(), sb.Address()) require.NoError(t, err) + defer c.Close() registry, err := sb.NewRegistry() if errors.Is(err, integration.ErrRequirements) { t.Skip(err.Error()) } + require.NoError(t, err) ps := []ocispecs.Platform{ platforms.MustParse("linux/amd64"), @@ -7617,11 +7621,13 @@ func testAttestationBundle(t *testing.T, sb integration.Sandbox) { requiresLinux(t) c, err := New(sb.Context(), sb.Address()) require.NoError(t, err) + defer c.Close() registry, err := sb.NewRegistry() if errors.Is(err, integration.ErrRequirements) { t.Skip(err.Error()) } + require.NoError(t, err) ps := []ocispecs.Platform{ platforms.MustParse("linux/amd64"), @@ -7766,11 +7772,13 @@ func testSBOMScan(t *testing.T, sb integration.Sandbox) { requiresLinux(t) c, err := New(sb.Context(), sb.Address()) require.NoError(t, err) + defer c.Close() registry, err := sb.NewRegistry() if errors.Is(err, integration.ErrRequirements) { t.Skip(err.Error()) } + require.NoError(t, err) p := platforms.MustParse("linux/amd64") pk := platforms.Format(p) @@ -8042,11 +8050,13 @@ func testSBOMScanSingleRef(t *testing.T, sb integration.Sandbox) { requiresLinux(t) c, err := New(sb.Context(), sb.Address()) require.NoError(t, err) + defer c.Close() registry, err := sb.NewRegistry() if errors.Is(err, integration.ErrRequirements) { t.Skip(err.Error()) } + require.NoError(t, err) p := platforms.DefaultSpec() pk := platforms.Format(p) @@ -8206,11 +8216,13 @@ func testSBOMSupplements(t *testing.T, sb integration.Sandbox) { requiresLinux(t) c, err := New(sb.Context(), sb.Address()) require.NoError(t, err) + defer c.Close() registry, err := sb.NewRegistry() if errors.Is(err, integration.ErrRequirements) { t.Skip(err.Error()) } + require.NoError(t, err) p := platforms.MustParse("linux/amd64") pk := platforms.Format(p)