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: minor improvements #124922

Merged
merged 2 commits into from
Jun 1, 2024
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
5 changes: 4 additions & 1 deletion pkg/cmd/roachtest/test_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,10 @@ type workerStatus struct {

ttr testToRunRes
t *testImpl
c *clusterImpl
// The cluster that the worker is currently operating on. If the worker is
// currently running a test, the test is using this cluster. Nil if the
// worker does not currently have a cluster.
c *clusterImpl
}
}

Expand Down
5 changes: 3 additions & 2 deletions pkg/cmd/roachtest/test_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,8 @@ func (r *testRunner) runWorker(
c.Save(ctx, "cluster saved since --debug-always set", l)
}

wStatus.SetCluster(c)

// Prepare the test's logger. Always set this up with real files, using a
// temp dir if necessary. This simplifies testing.
artifactsRootDir := lopt.artifactsDir
Expand Down Expand Up @@ -874,7 +876,6 @@ func (r *testRunner) runWorker(

c.goCoverDir = t.GoCoverArtifactsDir()

wStatus.SetCluster(c)
wStatus.SetTest(t, testToRun)
wStatus.SetStatus("running test")

Expand Down Expand Up @@ -1277,7 +1278,7 @@ func (r *testRunner) runTest(

// We still want to run the post-test assertions even if the test timed out as it
// might provide useful information about the health of the nodes. Any assertion failures
// will will be recorded against, and eventually fail, the test.
// will be recorded against, and eventually fail, the test.
if err := r.postTestAssertions(ctx, t, c, 10*time.Minute); err != nil {
l.Printf("error during post test assertions: %v; see test-post-assertions.log for details", err)
}
Expand Down
9 changes: 7 additions & 2 deletions pkg/roachprod/roachprod.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ func sortedClusters() []string {

// newCluster initializes a SyncedCluster for the given cluster name.
//
// The cluster name can include a node selector (e.g. "foo:1-3").
// The cluster name can include a node selector (e.g. "foo:1-3"). If the
// selector is missing, the returned cluster includes all the machines.
func newCluster(
l *logger.Logger, name string, opts ...install.ClusterSettingOption,
) (*install.SyncedCluster, error) {
Expand Down Expand Up @@ -969,6 +970,8 @@ sudo chmod 777 /mnt/data1
}

// Install installs third party software.
//
// The cluster name can include a node selector (e.g. "foo:1-3").
func Install(ctx context.Context, l *logger.Logger, clusterName string, software []string) error {
c, err := getClusterFromCache(l, clusterName)
if err != nil {
Expand Down Expand Up @@ -2312,7 +2315,7 @@ func StartFluentBit(
return fluentbit.Install(ctx, l, c, config)
}

// Stop stops Fluent Bit on the cluster identified by clusterName.
// StopFluentBit stops Fluent Bit on the cluster identified by clusterName.
func StopFluentBit(ctx context.Context, l *logger.Logger, clusterName string) error {
if err := LoadClusters(); err != nil {
return err
Expand Down Expand Up @@ -2671,6 +2674,8 @@ func Deploy(

// getClusterFromCache finds and returns a SyncedCluster from
// the local cluster cache.
//
// The cluster name can include a node selector (e.g. "foo:1-3").
func getClusterFromCache(
l *logger.Logger, clusterName string, opts ...install.ClusterSettingOption,
) (*install.SyncedCluster, error) {
Expand Down
Loading