command/e2etest: Ensure init fixes missing cache
We test that a deleted provider cache results in an error when running terraform plan, but previously did not test that running init (as instructed) would resolve the issue. This (failing) e2e test adds that step.
This commit is contained in:
parent
0fcb75020f
commit
1190b95fe2
|
@ -57,7 +57,7 @@ func TestProviderTampering(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
_, stderr, err := tf.Run("plan")
|
||||
stdout, stderr, err := tf.Run("plan")
|
||||
if err == nil {
|
||||
t.Fatalf("unexpected plan success\nstdout:\n%s", stdout)
|
||||
}
|
||||
|
@ -67,6 +67,16 @@ func TestProviderTampering(t *testing.T) {
|
|||
if want := `terraform init`; !strings.Contains(stderr, want) {
|
||||
t.Errorf("missing expected error message\nwant substring: %s\ngot:\n%s", want, stderr)
|
||||
}
|
||||
|
||||
// Running init as suggested resolves the problem
|
||||
_, stderr, err = tf.Run("init")
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected init error: %s\nstderr:\n%s", err, stderr)
|
||||
}
|
||||
_, stderr, err = tf.Run("plan")
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected plan error: %s\nstderr:\n%s", err, stderr)
|
||||
}
|
||||
})
|
||||
t.Run("null plugin package modified before plan", func(t *testing.T) {
|
||||
tf := e2e.NewBinary(terraformBin, seedDir)
|
||||
|
|
Loading…
Reference in New Issue