From 45cc61ecad8dd67ac1b17b1f8e03043ff6ab4792 Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Tue, 25 Oct 2022 16:04:40 -0700 Subject: [PATCH] fix(bigtable): fix flaky AdminBackUp test (#6917) * fix(bigtable): fix flaky AdminBackUp test * fix --- bigtable/integration_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bigtable/integration_test.go b/bigtable/integration_test.go index e8ad6f3a89be..da9e5419d65e 100644 --- a/bigtable/integration_test.go +++ b/bigtable/integration_test.go @@ -2579,9 +2579,8 @@ func TestIntegration_AdminBackup(t *testing.T) { t.Fatalf("NewInstanceAdminClient: %v", err) } defer iAdminClient.Close() - uniqueID := make([]byte, 4) - rand.Read(uniqueID) - diffInstance := fmt.Sprintf("%s-d-%x", testEnv.Config().Instance, uniqueID) + diffInstanceId := uid.NewSpace(testEnv.Config().Instance, &uid.Options{}) + diffInstance := diffInstanceId.New() diffCluster := sourceCluster + "-d" conf := &InstanceConf{ InstanceId: diffInstance, @@ -2619,7 +2618,8 @@ func TestIntegration_AdminBackup(t *testing.T) { t.Fatalf("Failed to generate a unique ID: %v", err) } - backupName := fmt.Sprintf("mybackup-%x", uniqueID) + backupUID := uid.NewSpace("mybackup-", &uid.Options{}) + backupName := backupUID.New() defer adminClient.DeleteBackup(ctx, sourceCluster, backupName) if err = adminClient.CreateBackup(ctx, tblConf.TableID, sourceCluster, backupName, time.Now().Add(8*time.Hour)); err != nil {