Correct name for force acquire deploy flag (#656)

## Changes
As discussed here, the name for this flag should be `force-lock`:
https://github.com/databricks/cli/pull/578#discussion_r1276233445

## Tests
Manually and existing tests
This commit is contained in:
shreyas-goenka 2023-08-15 21:03:43 +02:00 committed by GitHub
parent 6c644e159c
commit 6a843f28ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -17,7 +17,7 @@ func newDeployCommand() *cobra.Command {
var forceLock bool var forceLock bool
var computeID string var computeID string
cmd.Flags().BoolVar(&force, "force", false, "Force-override Git branch validation.") cmd.Flags().BoolVar(&force, "force", false, "Force-override Git branch validation.")
cmd.Flags().BoolVar(&forceLock, "force-deploy", false, "Force acquisition of deployment lock.") cmd.Flags().BoolVar(&forceLock, "force-lock", false, "Force acquisition of deployment lock.")
cmd.Flags().StringVarP(&computeID, "compute-id", "c", "", "Override compute in the deployment with the given compute ID.") cmd.Flags().StringVarP(&computeID, "compute-id", "c", "", "Override compute in the deployment with the given compute ID.")
cmd.RunE = func(cmd *cobra.Command, args []string) error { cmd.RunE = func(cmd *cobra.Command, args []string) error {

View File

@ -90,7 +90,7 @@ func TestAccLock(t *testing.T) {
indexOfAnInactiveLocker = i indexOfAnInactiveLocker = i
} }
assert.ErrorContains(t, lockerErrs[i], "lock acquired by") assert.ErrorContains(t, lockerErrs[i], "lock acquired by")
assert.ErrorContains(t, lockerErrs[i], "Use --force to override") assert.ErrorContains(t, lockerErrs[i], "Use --force-lock to override")
} }
} }
assert.Equal(t, 1, countActive, "Exactly one locker should successfull acquire the lock") assert.Equal(t, 1, countActive, "Exactly one locker should successfull acquire the lock")

View File

@ -105,10 +105,10 @@ func (locker *Locker) assertLockHeld(ctx context.Context) error {
return err return err
} }
if activeLockState.ID != locker.State.ID && !activeLockState.IsForced { if activeLockState.ID != locker.State.ID && !activeLockState.IsForced {
return fmt.Errorf("deploy lock acquired by %s at %v. Use --force to override", activeLockState.User, activeLockState.AcquisitionTime) return fmt.Errorf("deploy lock acquired by %s at %v. Use --force-lock to override", activeLockState.User, activeLockState.AcquisitionTime)
} }
if activeLockState.ID != locker.State.ID && activeLockState.IsForced { if activeLockState.ID != locker.State.ID && activeLockState.IsForced {
return fmt.Errorf("deploy lock force acquired by %s at %v. Use --force to override", activeLockState.User, activeLockState.AcquisitionTime) return fmt.Errorf("deploy lock force acquired by %s at %v. Use --force-lock to override", activeLockState.User, activeLockState.AcquisitionTime)
} }
return nil return nil
} }