From 152e0e21f986f78d0922fab42efb40e2476876ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Jamr=C3=B3z?= Date: Sat, 21 Oct 2023 20:21:21 +0200 Subject: [PATCH] Correlations: Allow the insert query to be retried in a test (#76877) Allow the insert query to be retried --- pkg/tests/api/correlations/correlations_read_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/tests/api/correlations/correlations_read_test.go b/pkg/tests/api/correlations/correlations_read_test.go index dc762e967ae..21aa09f2caf 100644 --- a/pkg/tests/api/correlations/correlations_read_test.go +++ b/pkg/tests/api/correlations/correlations_read_test.go @@ -106,8 +106,10 @@ func TestIntegrationReadCorrelation(t *testing.T) { // Given all tests in this file work on the assumption that only a single correlation exists, // this covers the case where bad data exists in the database. nonExistingDsUID := "THIS-DOES-NOT_EXIST" + var created int64 = 0 err := ctx.env.SQLStore.WithDbSession(context.Background(), func(sess *db.Session) error { - created, err := sess.InsertMulti(&[]correlations.Correlation{ + var innerError error + created, innerError = sess.InsertMulti(&[]correlations.Correlation{ { UID: "uid-1", SourceUID: dsWithoutCorrelations.UID, @@ -119,11 +121,10 @@ func TestIntegrationReadCorrelation(t *testing.T) { TargetUID: &dsWithoutCorrelations.UID, }, }) - require.NoError(t, err) - require.Equal(t, int64(2), created) - return err + return innerError }) require.NoError(t, err) + require.Equal(t, int64(2), created) t.Run("Get all correlations", func(t *testing.T) { t.Run("Unauthenticated users shouldn't be able to read correlations", func(t *testing.T) {