verify that a state can be read even when locked

This should only happen when a state is loaded via the backend, as well
as a remote state.
This commit is contained in:
James Bardin 2017-12-06 17:15:23 -05:00
parent 9dea2f78d4
commit 2932203492
1 changed files with 8 additions and 0 deletions

View File

@ -281,6 +281,14 @@ func testBackendStateLock(t *testing.T, b1, b2 Backend) {
t.Fatal("unable to get initial lock:", err)
}
// Make sure we can still get the state.State from another instance even
// when locked. This should only happen when a state is loaded via the
// backend, and as a remote state.
_, err = b2.State(DefaultStateName)
if err != nil {
t.Fatalf("failed to read locked state from another backend instance: %s", err)
}
// If the lock ID is blank, assume locking is disabled
if lockIDA == "" {
t.Logf("TestBackend: %T: empty string returned for lock, assuming disabled", b1)