mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-25 08:21:07 -06:00
states/remote: Check for LockError error type
When attempting to lock a remote state backend, failure due to an existing lock should return an instance of LockError. This allows the wrapping code to retry until the specified timeout, instead of immediately exiting. This commit adds a test for this in the TestRemoteLocks test helper, which is used in many of the remote state backend test suites.
This commit is contained in:
parent
b0b69d3fad
commit
d2087fa98b
@ -77,6 +77,9 @@ func TestRemoteLocks(t *testing.T, a, b Client) {
|
||||
lockerA.Unlock(lockIDA)
|
||||
t.Fatal("client B obtained lock while held by client A")
|
||||
}
|
||||
if _, ok := err.(*statemgr.LockError); !ok {
|
||||
t.Errorf("expected a LockError, but was %t: %s", err, err)
|
||||
}
|
||||
|
||||
if err := lockerA.Unlock(lockIDA); err != nil {
|
||||
t.Fatal("error unlocking client A", err)
|
||||
|
Loading…
Reference in New Issue
Block a user