Skip to content

Commit

Permalink
Merge pull request #137057 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-24.1-136725

release-24.1: roachtest: properly surface workload error in c2c tests
  • Loading branch information
msbutler authored Dec 10, 2024
2 parents afdd6a5 + f791928 commit c0e2751
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/cmd/roachtest/tests/cluster_to_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,7 @@ func (rd *replicationDriver) main(ctx context.Context) {
}()

workloadDoneCh := make(chan struct{})
workloadErrCh := make(chan error, 1)
workloadMonitor.Go(func(ctx context.Context) error {
defer close(workloadDoneCh)
err := rd.runWorkload(ctx)
Expand All @@ -940,8 +941,11 @@ func (rd *replicationDriver) main(ctx context.Context) {
if err != nil && ctx.Err() == nil {
// Implies the workload context was not cancelled and the workload cmd returned a
// different error.
rd.t.L().Printf("Workload context was not cancelled. Error returned by workload cmd: %s", err)
workloadErrCh <- err
return errors.Wrapf(err, `Workload context was not cancelled. Error returned by workload cmd`)
}
workloadErrCh <- nil
rd.t.L().Printf("workload successfully finished")
return nil
})
Expand Down Expand Up @@ -988,6 +992,9 @@ func (rd *replicationDriver) main(ctx context.Context) {
select {
case <-workloadDoneCh:
rd.t.L().Printf("workload finished on its own")
if err := <-workloadErrCh; err != nil {
rd.t.Fatal(err)
}
case <-time.After(rd.getWorkloadTimeout()):
workloadCancel()
rd.t.L().Printf("workload was cancelled after %s", rd.rs.additionalDuration)
Expand Down

0 comments on commit c0e2751

Please sign in to comment.