@@ -2,16 +2,20 @@ package tests
22
33import (
44 "os"
5+ "time"
56
67 "github.com/deis/workflow-e2e/tests/cmd"
78 "github.com/deis/workflow-e2e/tests/cmd/apps"
89 "github.com/deis/workflow-e2e/tests/cmd/auth"
910 "github.com/deis/workflow-e2e/tests/cmd/git"
1011 "github.com/deis/workflow-e2e/tests/cmd/keys"
1112 "github.com/deis/workflow-e2e/tests/model"
13+ "github.com/deis/workflow-e2e/tests/settings"
1214
1315 . "github.com/onsi/ginkgo"
1416 . "github.com/onsi/gomega"
17+ . "github.com/onsi/gomega/gbytes"
18+ . "github.com/onsi/gomega/gexec"
1519)
1620
1721var _ = Describe ("git push deis master" , func () {
@@ -70,6 +74,53 @@ var _ = Describe("git push deis master", func() {
7074 })
7175 })
7276
77+ Specify ("that user can deploy that app only once concurrently" , func () {
78+ sess := git .StartPush (user , keyPath )
79+ // sleep for five seconds, then push the same app
80+ time .Sleep (5000 * time .Millisecond )
81+ sess2 := git .StartPush (user , keyPath )
82+ Eventually (sess2 .Err ).Should (Say ("fatal: remote error: Another git push is ongoing" ))
83+ Eventually (sess2 ).Should (Exit (128 ))
84+ // TODO: loop until success
85+ Eventually (sess , settings .MaxEventuallyTimeout ).Should (Exit (0 ))
86+ })
87+
88+ Context ("and who has another local git repo containing buildpack source code" , func () {
89+
90+ BeforeEach (func () {
91+ os .Chdir (".." )
92+ output , err := cmd .Execute (`git clone https://github.com/deis/example-nodejs-express.git` )
93+ Expect (err ).NotTo (HaveOccurred (), output )
94+ })
95+
96+ Context ("and has run `deis apps:create` from within that repo" , func () {
97+
98+ var app2 model.App
99+
100+ BeforeEach (func () {
101+ os .Chdir ("example-nodejs-express" )
102+ app2 = apps .Create (user )
103+ })
104+
105+ AfterEach (func () {
106+ apps .Destroy (user , app2 )
107+ })
108+
109+ Specify ("that user can deploy both apps concurrently" , func () {
110+ os .Chdir ("../example-go" )
111+ sess := git .StartPush (user , keyPath )
112+ os .Chdir ("../example-nodejs-express" )
113+ sess2 := git .StartPush (user , keyPath )
114+ Eventually (sess , settings .MaxEventuallyTimeout ).Should (Exit (0 ))
115+ Eventually (sess2 , settings .MaxEventuallyTimeout ).Should (Exit (0 ))
116+ git .Curl (app , "Powered by Deis" )
117+ git .Curl (app2 , "Powered by Deis" )
118+ })
119+
120+ })
121+
122+ })
123+
73124 })
74125
75126 })
@@ -98,6 +149,53 @@ var _ = Describe("git push deis master", func() {
98149 git .Push (user , keyPath , app , "Powered by Deis" )
99150 })
100151
152+ Specify ("that user can deploy that app only once concurrently" , func () {
153+ sess := git .StartPush (user , keyPath )
154+ // sleep for five seconds, then push the same app
155+ time .Sleep (5000 * time .Millisecond )
156+ sess2 := git .StartPush (user , keyPath )
157+ Eventually (sess2 .Err ).Should (Say ("fatal: remote error: Another git push is ongoing" ))
158+ Eventually (sess2 ).Should (Exit (128 ))
159+ // TODO: loop until success
160+ Eventually (sess , settings .MaxEventuallyTimeout ).Should (Exit (0 ))
161+ })
162+
163+ Context ("and who has another local git repo containing dockerfile source code" , func () {
164+
165+ BeforeEach (func () {
166+ os .Chdir (".." )
167+ output , err := cmd .Execute (`git clone https://github.com/deis/example-dockerfile-python.git` )
168+ Expect (err ).NotTo (HaveOccurred (), output )
169+ })
170+
171+ Context ("and has run `deis apps:create` from within that repo" , func () {
172+
173+ var app2 model.App
174+
175+ BeforeEach (func () {
176+ os .Chdir ("example-dockerfile-python" )
177+ app2 = apps .Create (user )
178+ })
179+
180+ AfterEach (func () {
181+ apps .Destroy (user , app2 )
182+ })
183+
184+ Specify ("that user can deploy both apps concurrently" , func () {
185+ os .Chdir ("../example-dockerfile-http" )
186+ sess := git .StartPush (user , keyPath )
187+ os .Chdir ("../example-dockerfile-python" )
188+ sess2 := git .StartPush (user , keyPath )
189+ Eventually (sess , settings .MaxEventuallyTimeout ).Should (Exit (0 ))
190+ Eventually (sess2 , settings .MaxEventuallyTimeout ).Should (Exit (0 ))
191+ git .Curl (app , "Powered by Deis" )
192+ git .Curl (app2 , "Powered by Deis" )
193+ })
194+
195+ })
196+
197+ })
198+
101199 })
102200
103201 })
0 commit comments