From 8f74807891371aa8c7903d88b7ce44fce05c3fc8 Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Mon, 4 Aug 2025 17:03:21 -0400 Subject: [PATCH] tests: fix conflict from parallelism in state store variables test (#26426) The state store test for Variables check-and-set behavior for deletes uses the same state store for a set of parallel tests. But one of the tests overlaps another by using the same path, and this can cause spurious test failures by hitting the CAS conflict error. This overlap doesn't appear to be intentional, so change the test to use a different path. Also cleaned up some unused test helpers in the same file. --- nomad/state/state_store_variables_test.go | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/nomad/state/state_store_variables_test.go b/nomad/state/state_store_variables_test.go index 1847197de..39b8d982e 100644 --- a/nomad/state/state_store_variables_test.go +++ b/nomad/state/state_store_variables_test.go @@ -4,7 +4,6 @@ package state import ( - "encoding/json" "errors" "sort" "strings" @@ -735,22 +734,6 @@ func TestStateStore_ListVariablesByKeyID(t *testing.T) { must.Eq(t, 5, count) } -func printVariable(tsv *structs.VariableEncrypted) string { - b, _ := json.Marshal(tsv) - return string(b) -} - -func printVariables(tsvs []*structs.VariableEncrypted) string { - if len(tsvs) == 0 { - return "" - } - var out strings.Builder - for _, tsv := range tsvs { - out.WriteString(printVariable(tsv) + "\n") - } - return out.String() -} - // TestStateStore_Variables_DeleteCAS func TestStateStore_Variables_DeleteCAS(t *testing.T) { ci.Parallel(t) @@ -822,7 +805,7 @@ func TestStateStore_Variables_DeleteCAS(t *testing.T) { t.Run("real_locked_var-cas_0", func(t *testing.T) { ci.Parallel(t) sv := mock.VariableEncrypted() - sv.Path = "real_var/cas_0" + sv.Path = "real_locked_var/cas_0" resp := ts.VarSet(10, &structs.VarApplyStateRequest{ Op: structs.VarOpSet, Var: sv,