From 529f6290ac9d39d104c67fef844dbcbf8ab0963c Mon Sep 17 00:00:00 2001 From: Edward McFarlane <3036610+emcfarlane@users.noreply.github.com> Date: Thu, 3 Oct 2024 12:48:23 -0400 Subject: [PATCH] Fix flaky zip archive test (#3367) --- private/buf/cmd/buf/workspace_test.go | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/private/buf/cmd/buf/workspace_test.go b/private/buf/cmd/buf/workspace_test.go index 2765cff8f2..ee03b460e4 100644 --- a/private/buf/cmd/buf/workspace_test.go +++ b/private/buf/cmd/buf/workspace_test.go @@ -32,6 +32,7 @@ import ( "github.com/bufbuild/buf/private/pkg/osext" "github.com/bufbuild/buf/private/pkg/protoencoding" "github.com/bufbuild/buf/private/pkg/slicesext" + "github.com/bufbuild/buf/private/pkg/storage" "github.com/bufbuild/buf/private/pkg/storage/storagearchive" "github.com/bufbuild/buf/private/pkg/storage/storageos" "github.com/stretchr/testify/require" @@ -1686,19 +1687,12 @@ func createZipFromDir(t *testing.T, rootPath string, archiveName string) string storageos.ReadWriteBucketWithSymlinksIfSupported(), ) require.NoError(t, err) - - zipCloser, err := zipBucket.Put( + require.NoError(t, storage.PutPath( context.Background(), + zipBucket, archiveName, - ) - require.NoError(t, err) - t.Cleanup( - func() { - require.NoError(t, zipCloser.Close()) - }, - ) - _, err = zipCloser.Write(buffer.Bytes()) - require.NoError(t, err) + buffer.Bytes(), + )) return zipDir }