From 9438e078ce26d71442f84f9430a552822b8a0979 Mon Sep 17 00:00:00 2001 From: Darin Date: Tue, 7 Jul 2020 10:18:16 -0700 Subject: [PATCH] roachtest: fix acceptance/decommission The added --self flag makes the test fail with 20.1 and 19.2 With 20.1 the flag is not supported and so the expected result should reflect that the step where a node decommissions self will not happen. With 19.2 the match that --self is not supported doesn't work as the error message capitalization differs. The fix changes the expected result and corrects the match of --self not supported to work with 19.2 as well Release note (): --- pkg/cmd/roachtest/decommission.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/roachtest/decommission.go b/pkg/cmd/roachtest/decommission.go index 602d0c8c1cd8..5229a9bc7cfe 100644 --- a/pkg/cmd/roachtest/decommission.go +++ b/pkg/cmd/roachtest/decommission.go @@ -444,7 +444,7 @@ func runDecommissionAcceptance(ctx context.Context, t *test, c *cluster) { // Until 20.2, --self is not supported. // TODO(knz): Remove this alternative when roachtest does not // test any version lower than 20.2. - if strings.Contains(cmdOutput, "ERROR: unknown flag: --self") { + if strings.Contains(cmdOutput, ": unknown flag: --self") { t.l.Printf("--self not supported; skipping recommission with --self") selfFlagSupported = false } else { @@ -710,6 +710,12 @@ WHERE "eventType" IN ($1, $2) ORDER BY timestamp`, {"node_decommissioned", "1"}, } + if !selfFlagSupported { + // If `--self` is not supported then we don't expect to see + // node 1 self decommission and recommission (step 3 and 4) + expMatrix = append(expMatrix[:2], expMatrix[4:]...) + } + if !reflect.DeepEqual(matrix, expMatrix) { t.Fatalf("unexpected diff(matrix, expMatrix):\n%s\n%s\nvs.\n%s", pretty.Diff(matrix, expMatrix), matrix, expMatrix) }