Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
97811: cli: remove current version from declarative-print-rules test r=fqazi a=fqazi

Previously, when the test for declarative-print-rules was added it displayed the current version. This could be annoying during development as the version gets bumped up during the development of a release. To address this, this patch masks out the version number with the word latest.

Epic: none

Release note: None

Co-authored-by: Faizan Qazi <faizan@cockroachlabs.com>
  • Loading branch information
craig[bot] and fqazi committed Feb 28, 2023
2 parents db32e7e + e3d8d7c commit 998b030
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion pkg/cli/declarative_print_rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package cli

import (
"fmt"
"strings"
"testing"

"github.com/cockroachdb/cockroach/pkg/clusterversion"
Expand Down Expand Up @@ -43,7 +44,13 @@ func TestDeclarativeRules(t *testing.T) {

// Using datadriven allows TESTFLAGS=-rewrite.
datadriven.RunTest(t, datapathutils.TestDataPath(t, "declarative-rules", "invalid_version"), func(t *testing.T, td *datadriven.TestData) string {
return invalidOut
// Do not display the present current version within the output,
// for testing purposes. This can change from build to build, and
// need changes for every version bump.
return strings.Replace(invalidOut,
" "+clusterversion.ByKey(clusterversion.V23_1).String()+"\n",
" latest\n",
-1)
})
datadriven.RunTest(t, datapathutils.TestDataPath(t, "declarative-rules", "oprules"), func(t *testing.T, td *datadriven.TestData) string {
return opOut
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/testdata/declarative-rules/invalid_version
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ invalid_version
----
debug declarative-print-rules 1.1 op
unsupported version number, the supported versions are:
1000022.2-56
latest
1000022.2

0 comments on commit 998b030

Please sign in to comment.