Skip to content

Commit

Permalink
refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
bhshkh committed Jan 7, 2025
1 parent fd3ba83 commit 04b1819
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions bigtable/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
6 changes: 3 additions & 3 deletions bigtable/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
Expand Down

0 comments on commit 04b1819

Please sign in to comment.