diff --git a/pkg/cmd/roachtest/tests/mixed_version_backup.go b/pkg/cmd/roachtest/tests/mixed_version_backup.go index 84f1ed337993..840c2179b1a7 100644 --- a/pkg/cmd/roachtest/tests/mixed_version_backup.go +++ b/pkg/cmd/roachtest/tests/mixed_version_backup.go @@ -943,10 +943,10 @@ func newBackupCollection(name string, btype backupType, options []backupOption) func (bc *backupCollection) uri() string { // Append the `nonce` to the backup name since we are now sharing a - // global namespace represented by the cockroachdb-backup-testing + // global namespace represented by the BACKUP_TESTING_BUCKET // bucket. The nonce allows multiple people (or TeamCity builds) to // be running this test without interfering with one another. - return fmt.Sprintf("gs://cockroachdb-backup-testing/mixed-version/%s_%s?AUTH=implicit", bc.name, bc.nonce) + return fmt.Sprintf("gs://%s/mixed-version/%s_%s?AUTH=implicit", testutils.BackupTestingBucketLongTTL(), bc.name, bc.nonce) } func (bc *backupCollection) encryptionOption() *encryptionPassphrase { @@ -2136,8 +2136,8 @@ func registerBackupMixedVersion(r registry.Registry) { EncryptionSupport: registry.EncryptionMetamorphic, RequiresLicense: true, Run: func(ctx context.Context, t test.Test, c cluster.Cluster) { - if c.Spec().Cloud != spec.GCE { - t.Skip("uses gs://cockroachdb-backup-testing; see https://github.com/cockroachdb/cockroach/issues/105968") + if c.Spec().Cloud != spec.GCE && !c.IsLocal() { + t.Skip("uses gs://cockroachdb-backup-testing-long-ttl; see https://github.com/cockroachdb/cockroach/issues/105968") } roachNodes := c.Range(1, c.Spec().NodeCount-1) diff --git a/pkg/testutils/BUILD.bazel b/pkg/testutils/BUILD.bazel index 26c9b8dbdfb0..91349456cd68 100644 --- a/pkg/testutils/BUILD.bazel +++ b/pkg/testutils/BUILD.bazel @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "testutils", srcs = [ + "backup.go", "base.go", "dir.go", "error.go", diff --git a/pkg/testutils/backup.go b/pkg/testutils/backup.go new file mode 100644 index 000000000000..399b2eeec5e1 --- /dev/null +++ b/pkg/testutils/backup.go @@ -0,0 +1,47 @@ +// Copyright 2023 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package testutils + +import "os" + +const ( + defaultBackupBucket = "cockroachdb-backup-testing" + longTTLBackupTestingBucket = "cockroachdb-backup-testing-long-ttl" + backupTestingBucketEnvVar = "BACKUP_TESTING_BUCKET" + backupTestingBucketLongTTLEnvVar = "BACKUP_TESTING_BUCKET_LONG_TTL" +) + +// BackupTestingBucket returns the name of the external storage bucket that +// should be used in a test run. Most times, this will be the regular public +// bucket. In private test runs, the name of the bucket is passed through an +// environment variable. +func BackupTestingBucket() string { + if bucket := os.Getenv(backupTestingBucketEnvVar); bucket != "" { + return bucket + } + + return defaultBackupBucket +} + +// BackupTestingBucketLongTTL returns the name of the external storage bucket +// that should be used in a test run where the bucket's content may inform a +// debugging investigation. At the time of this comment, the ttl for the s3 and +// gcs buckets is 20 days. +// +// In private test runs, the name of the bucket is passed through an environment +// variable. +func BackupTestingBucketLongTTL() string { + if bucket := os.Getenv(backupTestingBucketLongTTLEnvVar); bucket != "" { + return bucket + } + + return longTTLBackupTestingBucket +} diff --git a/pkg/testutils/lint/lint_test.go b/pkg/testutils/lint/lint_test.go index f0990cf98086..f9c5fbc8bc3d 100644 --- a/pkg/testutils/lint/lint_test.go +++ b/pkg/testutils/lint/lint_test.go @@ -507,6 +507,7 @@ func TestLint(t *testing.T) { ":!cli/start.go", // The CLI needs the GOMEMLIMIT variable. ":!internal/codeowners/codeowners.go", // For BAZEL_TEST. ":!internal/team/team.go", // For BAZEL_TEST. + ":!testutils/backup.go", // For BACKUP_TESTING_BUCKET }, }, } {