-
Notifications
You must be signed in to change notification settings - Fork 108
/
untaint_test.go
49 lines (40 loc) · 995 Bytes
/
untaint_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package tfexec
import (
"context"
"testing"
"github.com/hashicorp/terraform-exec/tfexec/internal/testutil"
)
func TestUntaintCmd(t *testing.T) {
td := t.TempDir()
tf, err := NewTerraform(td, tfVersion(t, testutil.Latest_v1))
if err != nil {
t.Fatal(err)
}
// empty env, to avoid environ mismatch in testing
tf.SetEnv(map[string]string{})
t.Run("defaults", func(t *testing.T) {
untaintCmd := tf.untaintCmd(context.Background(), "aws_instance.foo")
assertCmd(t, []string{
"untaint",
"-no-color",
"-lock=true",
"aws_instance.foo",
}, nil, untaintCmd)
})
t.Run("override all defaults", func(t *testing.T) {
untaintCmd := tf.untaintCmd(context.Background(), "aws_instance.foo",
State("teststate"),
AllowMissing(true),
LockTimeout("200s"),
Lock(false))
assertCmd(t, []string{
"untaint",
"-no-color",
"-lock-timeout=200s",
"-state=teststate",
"-lock=false",
"-allow-missing",
"aws_instance.foo",
}, nil, untaintCmd)
})
}