Skip to content

Commit d47f790

Browse files
committed
fix(tests): report curl output if it wasn't "Powered by Deis"
If the smoke test fails, it now reports what curl does see to the test runner for help in debugging failures. The smoke test now registers with the router rather than directly to the controller at port 8000, and the .HostName config field was more appropriately named to .Domain.
1 parent c2f15a2 commit d47f790

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

tests/smoke_test.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type deisTestConfig struct {
1919
AuthKey string
2020
ExampleApp string
2121
Hosts string
22-
HostName string
22+
Domain string
2323
SSHKey string
2424
}
2525

@@ -28,7 +28,7 @@ var envCfg = deisTestConfig{
2828
os.Getenv("AUTH_KEY"),
2929
os.Getenv("DEIS_TEST_APP"),
3030
os.Getenv("DEIS_TEST_HOSTS"),
31-
os.Getenv("DEIS_TEST_HOSTNAME"),
31+
os.Getenv("DEIS_TEST_DOMAIN"),
3232
os.Getenv("DEIS_TEST_SSH_KEY"),
3333
}
3434

@@ -47,19 +47,19 @@ var smokeTests = []deisTest{
4747
{"", `
4848
if [ ! -f {{.AuthKey}} ]; then
4949
ssh-keygen -q -t rsa -f {{.AuthKey}} -N '' -C deis
50-
ssh-add {{.AuthKey}}
5150
fi
51+
ssh-add {{.AuthKey}}
5252
`},
5353
// Register a "test" Deis user with the CLI, or skip if already registered.
5454
{"", `
55-
deis register http://{{.HostName}}:8000 \
55+
deis register http://deis.{{.Domain}} \
5656
--username=test \
5757
--password=asdf1234 \
5858
--email=test@test.co.nz || true
5959
`},
6060
// Log in as the "test" user.
6161
{"", `
62-
deis login http://{{.HostName}}:8000 \
62+
deis login http://deis.{{.Domain}} \
6363
--username=test \
6464
--password=asdf1234
6565
`},
@@ -73,7 +73,7 @@ deis clusters:destroy dev --confirm=dev || true
7373
`},
7474
// Create a cluster named "dev".
7575
{"", `
76-
deis init dev {{.HostName}} --hosts={{.Hosts}} --auth={{.SSHKey}}
76+
deis init dev {{.Domain}} --hosts={{.Hosts}} --auth={{.SSHKey}}
7777
`},
7878
// Clone the example app git repository locally.
7979
{"", `
@@ -97,15 +97,17 @@ git push deis master
9797
// TODO: GH issue about this sleep hack
9898
// Test that the app's URL responds with "Powered by Deis".
9999
{"{{.ExampleApp}}", `
100-
sleep 6 && curl -s http://testing.{{.HostName}} | grep -q 'Powered by Deis'
100+
sleep 6 && curl -s http://testing.{{.Domain}} | grep -q 'Powered by Deis' || \
101+
(curl -v http://testing.{{.Domain}} ; exit 1)
101102
`},
102103
// Scale the app's web containers up to 3.
103104
{"{{.ExampleApp}}", `
104105
deis scale web=3 || deis scale cmd=3
105106
`},
106107
// Test that the app's URL responds with "Powered by Deis".
107108
{"{{.ExampleApp}}", `
108-
sleep 7 && curl -s http://testing.{{.HostName}} | grep -q 'Powered by Deis'
109+
sleep 7 && curl -s http://testing.{{.Domain}} | grep -q 'Powered by Deis' || \
110+
(curl -v http://testing.{{.Domain}} ; exit 1)
109111
`},
110112
}
111113

@@ -121,10 +123,10 @@ func TestSmokeExampleApp(t *testing.T) {
121123
cfg.ExampleApp = "example-ruby-sinatra"
122124
}
123125
if cfg.Hosts == "" {
124-
cfg.Hosts = "172.17.8.100"
126+
cfg.Hosts = "local.deisapp.com"
125127
}
126-
if cfg.HostName == "" {
127-
cfg.HostName = "local.deisapp.com"
128+
if cfg.Domain == "" {
129+
cfg.Domain = "local.deisapp.com"
128130
}
129131
if cfg.SSHKey == "" {
130132
cfg.SSHKey = "~/.vagrant.d/insecure_private_key"

0 commit comments

Comments
 (0)