From 7a0cfd1df43ee682757cc06fec7df349b191799f Mon Sep 17 00:00:00 2001 From: Edward McFarlane <3036610+emcfarlane@users.noreply.github.com> Date: Fri, 20 Sep 2024 11:07:46 -0400 Subject: [PATCH] Fix flaky symlink test on windows (#3332) --- private/pkg/storage/storageos/storageos_test.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/private/pkg/storage/storageos/storageos_test.go b/private/pkg/storage/storageos/storageos_test.go index b68106a68a..0ee54a66f2 100644 --- a/private/pkg/storage/storageos/storageos_test.go +++ b/private/pkg/storage/storageos/storageos_test.go @@ -85,17 +85,13 @@ func TestOS(t *testing.T) { require.NoError(t, err) tempDir = filepath.Join(tempDir, "sym") require.NoError(t, os.Symlink(actualTempDir, tempDir)) - t.Cleanup(func() { - if err := os.Remove(tempDir); err != nil { - t.Error(err) - } - }) provider := storageos.NewProvider(storageos.ProviderWithSymlinks()) bucket, err := provider.NewReadWriteBucket(tempDir, storageos.ReadWriteBucketWithSymlinksIfSupported()) require.NoError(t, err) - _, err = bucket.Get(ctx, "foo.txt") + foo, err := bucket.Get(ctx, "foo.txt") require.NoError(t, err) + require.NoError(t, foo.Close()) // Try reading a file as if foo.txt is a directory. _, err = bucket.Get(ctx, "foo.txt/bar.txt")