@@ -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+
75125func TestPush_input (t * testing.T ) {
76126 tmp , cwd := testCwd (t )
77127 defer testFixCwd (t , tmp , cwd )
0 commit comments