From 7845febeaf14e30bee56f18cb47baead92bc3935 Mon Sep 17 00:00:00 2001 From: Florian Stadler Date: Thu, 14 Nov 2024 17:49:43 +0100 Subject: [PATCH 1/2] Handle writer errors when creating archives for Lambda test --- provider/provider_nodejs_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/provider/provider_nodejs_test.go b/provider/provider_nodejs_test.go index 750c2d18dc5..5056e2dcc5b 100644 --- a/provider/provider_nodejs_test.go +++ b/provider/provider_nodejs_test.go @@ -21,6 +21,7 @@ import ( "github.com/pulumi/pulumi-aws/provider/v6/pkg/elb" "github.com/pulumi/pulumi/pkg/v3/testing/integration" "github.com/pulumi/pulumi/sdk/v3/go/auto/optpreview" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -207,6 +208,7 @@ func TestParallelLambdaCreation(t *testing.T) { return } + t.TempDir() tempFile, err := createLambdaArchive(25 * 1024 * 1024) require.NoError(t, err) defer os.Remove(tempFile) @@ -398,7 +400,12 @@ func createLambdaArchive(size int64) (string, error) { // Create a new zip archive zipWriter := zip.NewWriter(tempFile) - defer zipWriter.Close() + defer func() { + err := zipWriter.Close() + contract.AssertNoErrorf(err, "Failed closing zip archive") + err = tempFile.Close() + contract.AssertNoErrorf(err, "Failed closing temporary file") + }() randomDataReader := io.LimitReader(rand.Reader, size) From 91b4c045968cf26c4d6a4cabaea4dbcc99da802d Mon Sep 17 00:00:00 2001 From: Florian Stadler Date: Thu, 14 Nov 2024 22:46:31 +0100 Subject: [PATCH 2/2] Remove unrelated change --- provider/provider_nodejs_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/provider/provider_nodejs_test.go b/provider/provider_nodejs_test.go index 5056e2dcc5b..c7f1463e637 100644 --- a/provider/provider_nodejs_test.go +++ b/provider/provider_nodejs_test.go @@ -208,7 +208,6 @@ func TestParallelLambdaCreation(t *testing.T) { return } - t.TempDir() tempFile, err := createLambdaArchive(25 * 1024 * 1024) require.NoError(t, err) defer os.Remove(tempFile)