Skip to content

Commit 59e7511

Browse files
committed
Add locks to test
1 parent 78bedbd commit 59e7511

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

internal/command/meta_backend_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2299,11 +2299,27 @@ func TestMetaBackend_reconfigureStateStoreChange(t *testing.T) {
22992299
return mock, nil
23002300
}
23012301

2302+
// Create locks - these would normally be the locks derived from config
2303+
locks := depsfile.NewLocks()
2304+
constraint, err := providerreqs.ParseVersionConstraints(">9.0.0")
2305+
if err != nil {
2306+
t.Fatalf("test setup failed when making constraint: %s", err)
2307+
}
2308+
expectedVersionString := "9.9.9"
2309+
expectedProviderSource := "registry.terraform.io/my-org/foo"
2310+
locks.SetProvider(
2311+
addrs.MustParseProviderSourceString(expectedProviderSource),
2312+
versions.MustParseVersion(expectedVersionString),
2313+
constraint,
2314+
[]providerreqs.Hash{"h1:foo"},
2315+
)
2316+
23022317
// Get the operations backend
23032318
_, beDiags := m.Backend(&BackendOpts{
23042319
Init: true,
23052320
StateStoreConfig: mod.StateStore,
23062321
ProviderFactory: factory,
2322+
Locks: locks,
23072323
})
23082324

23092325
if !beDiags.HasErrors() {

0 commit comments

Comments
 (0)