Skip to content

Commit

Permalink
Merge pull request #111086 from msbutler/butler-backport-ttl-bucket
Browse files Browse the repository at this point in the history
release-23.1: roachtest: codify longer ttl external storage buckets
  • Loading branch information
msbutler committed Sep 22, 2023
2 parents cd085e7 + 1537d25 commit 65df41b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/cmd/roachtest/tests/mixed_version_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions pkg/testutils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
47 changes: 47 additions & 0 deletions pkg/testutils/backup.go
Original file line number Diff line number Diff line change
@@ -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
}
1 change: 1 addition & 0 deletions pkg/testutils/lint/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
},
} {
Expand Down

0 comments on commit 65df41b

Please sign in to comment.