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: fix release-20.1 roachtests failing due to double-init #52040

Merged
merged 1 commit into from
Jul 29, 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
36 changes: 36 additions & 0 deletions pkg/cmd/roachprod/install/cockroach.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,26 @@ func (r Cockroach) Start(c *SyncedCluster, extraArgs []string) {
}
}

if !vers.AtLeast(version.MustParse("v20.1.0")) {
// Given #51897 remains unresolved, master-built roachprod is used
// to run roachtests against the 20.1 branch. Some of those
// roachtests test mixed-version clusters that start off at 19.2.
// Consequently, we manually add this `cluster-bootstrapped` file
// where roachprod expects to find it for already-initialized
// clusters. This is a pretty gross hack, that we should address by
// addressing #51897.
//
// TODO(irfansharif): Remove this once #51897 is resolved.
markBootstrap := fmt.Sprintf("touch %s/%s", h.c.Impl.NodeDir(h.c, nodes[nodeIdx]), "cluster-bootstrapped")
cmdOut, err := h.run(nodeIdx, markBootstrap)
if err != nil {
log.Fatalf("unable to run cmd: %v", err)
}
if cmdOut != "" {
fmt.Println(cmdOut)
}
}

fmt.Printf("%s: setting cluster settings", h.c.Name)
clusterSettingsOut, err := h.setClusterSettings(nodeIdx)
if err != nil {
Expand Down Expand Up @@ -622,3 +642,19 @@ func (h *crdbStartHelper) getEnvVars() string {
}
return buf.String()
}

func (h *crdbStartHelper) run(nodeIdx int, cmd string) (string, error) {
nodes := h.c.ServerNodes()

sess, err := h.c.newSession(nodes[nodeIdx])
if err != nil {
return "", err
}
defer sess.Close()

out, err := sess.CombinedOutput(cmd)
if err != nil {
return "", errors.Wrapf(err, "~ %s\n%s", cmd, out)
}
return strings.TrimSpace(string(out)), nil
}
4 changes: 4 additions & 0 deletions pkg/cmd/roachtest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ the test tags.
},
}

// TODO(irfansharif): We could remove this by directly running `cockroach
// version` against the binary being tested, instead of what we do today
// which is defaulting to checking the last git release tag present in the
// local checkout.
runCmd.Flags().StringVar(
&buildTag, "build-tag", "", "build tag (auto-detect if empty)")
runCmd.Flags().StringVar(
Expand Down