From 44fd85c751a2055f08775a319276cc5e108901a8 Mon Sep 17 00:00:00 2001 From: Michael Li Date: Fri, 16 Dec 2022 12:16:17 -0500 Subject: [PATCH] fix(kms/test): Fix flake (#2723) There was some flakiness observed in this test, where keyCount was reported to be 21. To prevent any potential conflicts, we are making the sub-tests not run in parallel. --- internal/kms/kms_test.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/internal/kms/kms_test.go b/internal/kms/kms_test.go index 86eb7fdcbf..0ea00bb1b6 100644 --- a/internal/kms/kms_test.go +++ b/internal/kms/kms_test.go @@ -202,7 +202,6 @@ func Test_RotateKeys(t *testing.T) { rw := db.New(conn) t.Run("success", func(t *testing.T) { - t.Parallel() // arrange // we're not trying to test the ListKeys function, although we need to use it to validate the rotation keys, err := kmsCache.ListKeys(testCtx, "global") @@ -222,11 +221,10 @@ func Test_RotateKeys(t *testing.T) { keyCount += len(key.Versions) } - require.Equal(t, keyCount, 14) + require.Equal(t, 14, keyCount) }) t.Run("reader provided, missing writer", func(t *testing.T) { - t.Parallel() // arrange WithReader := func(reader db.Reader) Option { return func(o *options) { @@ -242,7 +240,6 @@ func Test_RotateKeys(t *testing.T) { }) t.Run("writer provided, missing reader", func(t *testing.T) { - t.Parallel() // arrange WithWriter := func(writer db.Writer) Option { return func(o *options) { @@ -258,7 +255,6 @@ func Test_RotateKeys(t *testing.T) { }) t.Run("invalid reader", func(t *testing.T) { - t.Parallel() // act err := kmsCache.RotateKeys(testCtx, "global", WithReaderWriter(&invalidReader{}, rw)) @@ -267,7 +263,6 @@ func Test_RotateKeys(t *testing.T) { }) t.Run("invalid writer", func(t *testing.T) { - t.Parallel() // act err := kmsCache.RotateKeys(testCtx, "global", WithReaderWriter(rw, &invalidWriter{})) @@ -276,8 +271,7 @@ func Test_RotateKeys(t *testing.T) { }) t.Run("both reader and writer succeed", func(t *testing.T) { - t.Parallel() - err = kmsCache.RotateKeys(testCtx, "global", WithReaderWriter(rw, rw)) + err := kmsCache.RotateKeys(testCtx, "global", WithReaderWriter(rw, rw)) require.NoError(t, err) })