Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roachtest: deflake some tests #53679

Merged
merged 1 commit into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions pkg/cmd/roachtest/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,8 @@ func runCLINodeStatus(ctx context.Context, t *test, c *cluster) {

lastWords := func(s string) []string {
var result []string
s = elideInsecureDeprecationNotice(s)
lines := strings.Split(s, "\n")
// v20.1 introduces a deprecation notice for --insecure. Skip over it.
// TODO(knz): Remove this when --insecure is dropped.
// See: https://github.com/cockroachdb/cockroach/issues/53404
if len(lines) > 0 && strings.HasPrefix(lines[0], "Flag --insecure has been deprecated") {
lines = lines[2:]
}
for _, line := range lines {
words := strings.Fields(line)
if n := len(words); n > 0 {
Expand Down
13 changes: 13 additions & 0 deletions pkg/cmd/roachtest/decommission.go
Original file line number Diff line number Diff line change
Expand Up @@ -902,8 +902,20 @@ func (h *decommTestHelper) recommission(
return execCLI(ctx, h.t, h.c, runNode, args...)
}

func elideInsecureDeprecationNotice(csvStr string) string {
// v20.1 introduces a deprecation notice for --insecure. Skip over it.
// TODO(knz): Remove this when --insecure is dropped.
// See: https://github.com/cockroachdb/cockroach/issues/53404
lines := strings.SplitN(csvStr, "\n", 3)
if len(lines) > 0 && strings.HasPrefix(lines[0], "Flag --insecure has been deprecated") {
csvStr = lines[2]
}
return csvStr
}

// getCsvNumCols returns the number of columns in the given csv string.
func (h *decommTestHelper) getCsvNumCols(csvStr string) (cols int) {
csvStr = elideInsecureDeprecationNotice(csvStr)
reader := csv.NewReader(strings.NewReader(csvStr))
records, err := reader.Read()
if err != nil {
Expand All @@ -922,6 +934,7 @@ func (h *decommTestHelper) matchCSV(csvStr string, matchColRow [][]string) (err
}
}()

csvStr = elideInsecureDeprecationNotice(csvStr)
reader := csv.NewReader(strings.NewReader(csvStr))
reader.FieldsPerRecord = -1
records, err := reader.ReadAll()
Expand Down