Skip to content

Commit 11a388d

Browse files
committed
Update test - remove steps that are impossible to perform with inmem state storage.
1 parent 686133b commit 11a388d

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

internal/command/e2etest/primary_test.go

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,8 @@ func TestPrimary_stateStore(t *testing.T) {
247247

248248
tf := e2e.NewBinary(t, terraformBin, "testdata/full-workflow-with-state-store")
249249

250-
// In order to do a decent end-to-end test for this case we will need a real
251-
// enough provider plugin to try to run and make sure we are able to
252-
// actually run it. Here will build the simple and simple6 (built with
253-
// protocol v6) providers.
250+
// In order to test integration with PSS we need a provider plugin implementing a state store.
251+
// Here will build the simple6 (built with protocol v6) provider, which implements PSS.
254252
simple6Provider := filepath.Join(tf.WorkDir(), "terraform-provider-simple6")
255253
simple6ProviderExe := e2e.GoBuild("github.com/hashicorp/terraform/internal/provider-simple-v6/main", simple6Provider)
256254

@@ -288,28 +286,8 @@ func TestPrimary_stateStore(t *testing.T) {
288286
t.Errorf("incorrect apply tally; want 1 added:\n%s", stdout)
289287
}
290288

291-
// INSPECT STATE
292-
stdout, stderr, err = tf.Run("state", "list")
293-
294-
//// DESTROY
295-
stdout, stderr, err = tf.Run("destroy", "-auto-approve")
296-
if err != nil {
297-
t.Fatalf("unexpected destroy error: %s\nstderr:\n%s", err, stderr)
298-
}
299-
300-
if !strings.Contains(stdout, "Resources: 1 destroyed") {
301-
t.Errorf("incorrect destroy tally; want 1 destroyed:\n%s", stdout)
302-
}
303-
304-
state, err := tf.LocalState()
305-
if err != nil {
306-
t.Fatalf("failed to read state file after destroy: %s", err)
307-
}
308-
309-
stateResources := state.RootModule().Resources
310-
if len(stateResources) != 0 {
311-
t.Errorf("wrong resources in state after destroy; want none, but still have:%s", spew.Sdump(stateResources))
312-
}
289+
// We cannot inspect state or perform a destroy here, as the state isn't persisted between steps
290+
// when we use the simple6_inmem state store.
313291
}
314292

315293
// TODO: TestPrimarySeparatePlan_stateStore - once support for PSS in plan files is implemented

0 commit comments

Comments
 (0)