From 04b1819948bc7d0ad4ea0259ac094a214f28fdd9 Mon Sep 17 00:00:00 2001 From: Baha Aiman Date: Tue, 7 Jan 2025 21:42:28 +0000 Subject: [PATCH] refactor code --- bigtable/admin.go | 6 +----- bigtable/integration_test.go | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/bigtable/admin.go b/bigtable/admin.go index 794f27aaa2bc..a9737946eb1d 100644 --- a/bigtable/admin.go +++ b/bigtable/admin.go @@ -2195,15 +2195,11 @@ func WithHotBackup() BackupOption { // CreateBackup creates a new backup in the specified cluster from the // specified source table with the user-provided expire time. func (ac *AdminClient) CreateBackup(ctx context.Context, table, cluster, backup string, expireTime time.Time) error { - return ac.createBackup(ctx, table, cluster, backup, WithExpiry(expireTime)) + return ac.CreateBackupWithOptions(ctx, table, cluster, backup, WithExpiry(expireTime)) } // CreateBackupWithOptions is similar to CreateBackup but lets the user specify additional options. func (ac *AdminClient) CreateBackupWithOptions(ctx context.Context, table, cluster, backup string, opts ...BackupOption) error { - return ac.createBackup(ctx, table, cluster, backup, opts...) -} - -func (ac *AdminClient) createBackup(ctx context.Context, table, cluster, backup string, opts ...BackupOption) error { ctx = mergeOutgoingMetadata(ctx, ac.md) prefix := ac.instancePrefix() diff --git a/bigtable/integration_test.go b/bigtable/integration_test.go index 67a4f0cd9bf8..4a8233fd105e 100644 --- a/bigtable/integration_test.go +++ b/bigtable/integration_test.go @@ -3983,9 +3983,9 @@ func TestIntegration_AdminUpdateBackupHotToStandardTime(t *testing.T) { t.Fatalf("BackupInfo: %v", err) } gotHtsTime := updatedBackup.HotToStandardTime - if (test.wantHtsTime != nil && !test.wantHtsTime.Equal(*gotHtsTime)) || - (test.wantHtsTime == nil && gotHtsTime != nil) || - (test.wantHtsTime != nil && gotHtsTime == nil) { + if (test.wantHtsTime == nil && gotHtsTime != nil) || + (test.wantHtsTime != nil && gotHtsTime == nil) || + (test.wantHtsTime != nil && !test.wantHtsTime.Equal(*gotHtsTime)) { t.Errorf("hot_to_standard_time got: %v, want: %v", gotHtsTime, test.wantHtsTime) } })