From 000b4f878d5265594437dbffa2acc4ac193f99f0 Mon Sep 17 00:00:00 2001 From: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com> Date: Wed, 9 Nov 2022 19:56:47 +0200 Subject: [PATCH] Chore: Retry queries by default in tests (#58535) --- pkg/tests/testinfra/testinfra.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/tests/testinfra/testinfra.go b/pkg/tests/testinfra/testinfra.go index ed897a4b1a6..fe13679fc59 100644 --- a/pkg/tests/testinfra/testinfra.go +++ b/pkg/tests/testinfra/testinfra.go @@ -314,12 +314,15 @@ func CreateGrafDir(t *testing.T, opts ...GrafanaOpts) (string, string) { _, err = logSection.NewKey("address", o.GRPCServerAddress) require.NoError(t, err) } + // retry queries 3 times by default + queryRetries := 3 if o.QueryRetries != 0 { - logSection, err := getOrCreateSection("database") - require.NoError(t, err) - _, err = logSection.NewKey("query_retries", fmt.Sprintf("%d", o.QueryRetries)) - require.NoError(t, err) + queryRetries = int(o.QueryRetries) } + logSection, err := getOrCreateSection("database") + require.NoError(t, err) + _, err = logSection.NewKey("query_retries", fmt.Sprintf("%d", queryRetries)) + require.NoError(t, err) } cfgPath := filepath.Join(cfgDir, "test.ini")