mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
backend/local: test fixes
for TestLocal_applyBackendFail, config is relative to the tests' wd
This commit is contained in:
parent
d865df7338
commit
e84def1e29
@ -181,12 +181,15 @@ test_instance.foo:
|
||||
}
|
||||
|
||||
func TestLocal_applyBackendFail(t *testing.T) {
|
||||
op, configCleanup := testOperationApply(t, "./test-fixtures/apply")
|
||||
defer configCleanup()
|
||||
|
||||
b, cleanup := TestLocal(t)
|
||||
defer cleanup()
|
||||
|
||||
p := TestLocalProvider(t, b, "test", applyFixtureSchema())
|
||||
p.ApplyResourceChangeResponse = providers.ApplyResourceChangeResponse{NewState: cty.ObjectVal(map[string]cty.Value{
|
||||
"id": cty.StringVal("yes"),
|
||||
"ami": cty.StringVal("bar"),
|
||||
})}
|
||||
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
t.Fatalf("failed to get current working directory")
|
||||
@ -197,11 +200,11 @@ func TestLocal_applyBackendFail(t *testing.T) {
|
||||
}
|
||||
defer os.Chdir(wd)
|
||||
|
||||
op, configCleanup := testOperationApply(t, wd+"/test-fixtures/apply")
|
||||
defer configCleanup()
|
||||
|
||||
b.Backend = &backendWithFailingState{}
|
||||
b.CLI = new(cli.MockUi)
|
||||
p := TestLocalProvider(t, b, "test", applyFixtureSchema())
|
||||
|
||||
p.ApplyResourceChangeResponse = providers.ApplyResourceChangeResponse{NewState: cty.ObjectVal(map[string]cty.Value{"id": cty.StringVal("yes")})}
|
||||
|
||||
run, err := b.Operation(context.Background(), op)
|
||||
if err != nil {
|
||||
@ -223,6 +226,7 @@ func TestLocal_applyBackendFail(t *testing.T) {
|
||||
test_instance.foo:
|
||||
ID = yes
|
||||
provider = provider.test
|
||||
ami = bar
|
||||
`)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user