Skip to content

Commit

Permalink
Merge #124922
Browse files Browse the repository at this point in the history
124922: roachtest: minor improvements r=srosenberg a=andreimatei

See individual commits.
The commits were extracted from #124780.

Co-authored-by: Andrei Matei <[email protected]>
  • Loading branch information
craig[bot] and andreimatei committed Jun 1, 2024
2 parents 1d6f396 + bcd7349 commit 1e4cab3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
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

0 comments on commit 1e4cab3

Please sign in to comment.