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: simplify name resolution in new restore roachtests #98087

Merged
merged 1 commit into from
Mar 6, 2023
Merged
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: 21 additions & 15 deletions pkg/cmd/roachtest/tests/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,12 +523,13 @@ func registerRestore(r registry.Registry) {
backup: makeBackupSpecs(
backupSpecs{workload: tpceRestore{customers: 5000},
version: "v22.2.1"}),
timeout: 3 * time.Hour,
timeout: 3 * time.Hour,
namePrefix: "pause",
}
withPauseTestName := withPauseSpecs.computeName("pause", false)
withPauseSpecs.initTestName()

r.Add(registry.TestSpec{
Name: withPauseTestName,
Name: withPauseSpecs.testName,
Owner: registry.OwnerDisasterRecovery,
Cluster: withPauseSpecs.hardware.makeClusterSpecs(r),
Timeout: withPauseSpecs.timeout,
Expand All @@ -542,7 +543,7 @@ func registerRestore(r registry.Registry) {
c.Start(ctx, t.L(), option.DefaultStartOptsNoBackups(), install.MakeClusterSettings())
m := c.NewMonitor(ctx)

withPauseSpecs.getRuntimeSpecs(ctx, t, c, withPauseTestName)
withPauseSpecs.getRuntimeSpecs(ctx, t, c)
// Run the disk usage logger in the monitor to guarantee its
// having terminated when the test ends.
dul := NewDiskUsageLogger(t, c)
Expand Down Expand Up @@ -713,9 +714,9 @@ func registerRestore(r registry.Registry) {
// - restore/tpce/400GB/encryption
} {
sp := sp
testName := sp.computeName("", false)
sp.initTestName()
r.Add(registry.TestSpec{
Name: testName,
Name: sp.testName,
Owner: registry.OwnerDisasterRecovery,
Cluster: sp.hardware.makeClusterSpecs(r),
Timeout: sp.timeout,
Expand All @@ -725,7 +726,7 @@ func registerRestore(r registry.Registry) {
Tags: sp.tags,
Run: func(ctx context.Context, t test.Test, c cluster.Cluster) {

t.L().Printf("Full test specs: %s", sp.computeName("", true))
t.L().Printf("Full test specs: %s", sp.computeName(true))

if c.Spec().Cloud != sp.backup.cloud {
// For now, only run the test on the cloud provider that also stores the backup.
Expand All @@ -742,7 +743,7 @@ func registerRestore(r registry.Registry) {
hc := NewHealthChecker(t, c, c.All())
m.Go(hc.Runner)

sp.getRuntimeSpecs(ctx, t, c, testName)
sp.getRuntimeSpecs(ctx, t, c)
m.Go(func(ctx context.Context) error {
defer dul.Done()
defer hc.Done()
Expand Down Expand Up @@ -951,14 +952,22 @@ type restoreSpecs struct {
timeout time.Duration
tags []string

// namePrefix appears in the name of the roachtest, i.e. `restore/{prefix}/{config}`.
namePrefix string

t test.Test
c cluster.Cluster
testName string
}

func (sp *restoreSpecs) computeName(prefix string, verbose bool) string {
if prefix != "" {
prefix = "/" + prefix
func (sp *restoreSpecs) initTestName() {
sp.testName = sp.computeName(false)
}

func (sp *restoreSpecs) computeName(verbose bool) string {
var prefix string
if sp.namePrefix != "" {
prefix = "/" + sp.namePrefix
}
return "restore" + prefix + sp.backup.String(verbose) + sp.hardware.String(verbose)
}
Expand All @@ -968,12 +977,9 @@ func (sp *restoreSpecs) restoreCmd(target, opts string) string {
target, sp.backup.fullBackupDir, sp.backup.backupCollection(), sp.backup.aost, opts)
}

func (sp *restoreSpecs) getRuntimeSpecs(
ctx context.Context, t test.Test, c cluster.Cluster, testName string,
) {
func (sp *restoreSpecs) getRuntimeSpecs(ctx context.Context, t test.Test, c cluster.Cluster) {
sp.t = t
sp.c = c
sp.testName = testName

var aost string
conn := sp.c.Conn(ctx, sp.t.L(), 1)
Expand Down