Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit edda576

Browse files
committed
command/push: test that -upload-modules=false works
1 parent 7848134 commit edda576

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

command/push_test.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,56 @@ func TestPush_good(t *testing.T) {
7272
}
7373
}
7474

75+
func TestPush_noUploadModules(t *testing.T) {
76+
tmp, cwd := testCwd(t)
77+
defer testFixCwd(t, tmp, cwd)
78+
79+
// Create remote state file, this should be pulled
80+
conf, srv := testRemoteState(t, testState(), 200)
81+
defer srv.Close()
82+
83+
// Persist local remote state
84+
s := terraform.NewState()
85+
s.Serial = 5
86+
s.Remote = conf
87+
testStateFileRemote(t, s)
88+
89+
// Path where the archive will be "uploaded" to
90+
archivePath := testTempFile(t)
91+
defer os.Remove(archivePath)
92+
93+
client := &mockPushClient{File: archivePath}
94+
ui := new(cli.MockUi)
95+
c := &PushCommand{
96+
Meta: Meta{
97+
ContextOpts: testCtxConfig(testProvider()),
98+
Ui: ui,
99+
},
100+
101+
client: client,
102+
}
103+
104+
args := []string{
105+
"-vcs=false",
106+
"-upload-modules=false",
107+
testFixturePath("push-no-upload"),
108+
}
109+
if code := c.Run(args); code != 0 {
110+
t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String())
111+
}
112+
113+
actual := testArchiveStr(t, archivePath)
114+
expected := []string{
115+
".terraform/", // Weird but doesn't cause any problems
116+
".terraform/",
117+
".terraform/terraform.tfstate",
118+
"main.tf",
119+
}
120+
if !reflect.DeepEqual(actual, expected) {
121+
t.Fatalf("bad: %#v", actual)
122+
}
123+
}
124+
75125
func TestPush_input(t *testing.T) {
76126
tmp, cwd := testCwd(t)
77127
defer testFixCwd(t, tmp, cwd)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resource "aws_instance" "foo" {}
2+
3+
atlas {
4+
name = "foo"
5+
}

0 commit comments

Comments
 (0)