Skip to content

Commit c56dabd

Browse files
committed
Merge pull request #1497 from deis/integration-test-fixes
fix(tests): integration improvements and documentation
2 parents deed931 + 1950a27 commit c56dabd

19 files changed

Lines changed: 223 additions & 174 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ test-components:
160160
)
161161

162162
test-integration:
163-
$(MAKE) -C tests/ test
163+
$(MAKE) -C tests/ test-full
164164

165165
test-smoke:
166166
$(MAKE) -C tests/ test-smoke

tests/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
test:
2-
GOPATH=$(CURDIR)/_vendor:$(GOPATH) \
3-
go test -tags integration -v -run TestSmoke
1+
test: test-smoke
42

53
test-smoke:
64
GOPATH=$(CURDIR)/_vendor:$(GOPATH) \

tests/README.md

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,64 @@
1-
# Deis integration testing
1+
# Deis Tests
22

3-
This directory contains a Go package which will run integration tests on an
4-
existing Deis cluster.
3+
This directory contains a [Go](http://golang.org/) package with integration
4+
tests for the [Deis](http://deis.io/) open source PaaS.
55

6-
Repo should be properly checked out into your GOPATH
7-
go get github.com/deis/deis
6+
[![GoDoc](https://godoc.org/github.com/deis/deis/tests?status.svg)](https://godoc.org/github.com/deis/deis/tests)
87

9-
To run all tests:
8+
**NOTE**: These integration tests are targeted for use in Deis'
9+
[continuous integration system](http://ci.deis.io/). The tests currently assume
10+
they are targeting a freshly provisioned Deis cluster. **Don't** run the
11+
integration tests on a Deis installation with existing users; the tests will
12+
fail and could overwrite data.
13+
14+
## Test Setup
15+
16+
Check out [Deis' source code](https://github.com/deis/deis) into the `$GOPATH`:
17+
18+
```console
19+
$ go get -u -v github.com/deis/deis
20+
$ cd $GOPATH/src/github.com/deis/deis/tests
21+
```
22+
23+
Provision a Deis cluster as usual, and ensure that a matching `deis`
24+
command-line client is available in your `$PATH`.
25+
26+
Create two SSH keys:
27+
28+
```console
29+
$ ssh-keygen -q -t rsa -f ~/.ssh/deis -N '' -C deis
30+
$ ssh-keygen -q -t rsa -f ~/.ssh/deiskey -N '' -C deiskey
31+
```
32+
33+
The first key `deis` is used for authentication against Deis by the `test` user
34+
who runs the integration tests. The second `deiskey` is used only for testing
35+
`deis keys:add`, `deis keys:list`, and related commands.
36+
37+
## Test Execution
38+
39+
Run all the integration tests:
1040

1141
```console
12-
$ go test -v -tags integration -timeout 50m ./...
42+
$ make test-full
1343
```
1444

15-
The test environment uses several environment variables, which can be set to customize the run:
16-
* `DEIS_TEST_AUTH_KEY` - SSH key used to register with the Deis controller -- will be generated if it doesn't exist (default: `~/.ssh/deis`)
17-
* `DEIS_TEST_KEY` - SSH key used to login to the controller machine (default: `~/.vagrant.d/insecure_private_key`)
18-
* `DEIS_TEST_HOSTNAME` - hostname which resolves to the controller host (default: `local.deisapp.com`)
19-
* `DEIS_TEST_HOSTS` - comma-separated list of IPs for nodes in the cluster -- should be internal IPs for cloud providers (default: `172.17.8.100`)
20-
* `DEIS_TEST_APP` - name of the Deis example app to use, which is cloned from GitHub (default: `example-ruby-sinatra`)
45+
Or run just the [smoke test](http://www.catb.org/jargon/html/S/smoke-test.html):
46+
47+
```console
48+
$ make test-smoke
49+
```
50+
51+
## Customizing Test Runs
52+
53+
These environment variables can be set to customize the test run:
54+
* `DEIS_TEST_AUTH_KEY` - SSH key used to register with the Deis controller
55+
(default: `~/.ssh/deis`)
56+
* `DEIS_TEST_SSH_KEY` - SSH key used to login to the controller machine
57+
(default: `~/.vagrant.d/insecure_private_key`)
58+
* `DEIS_TEST_DOMAIN` - the domain to use for testing
59+
(default: `local.deisapp.com`)
60+
* `DEIS_TEST_HOSTS` - comma-separated list of IPs for nodes in the cluster,
61+
should be internal IPs for cloud providers (default: `172.17.8.100`)
62+
* `DEIS_TEST_APP` - name of the
63+
[Deis example app](https://github.com/deis?query=example-) to use, which is
64+
cloned from GitHub (default: random)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.1
1+
1.1.2

tests/apps_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package tests
44

55
import (
66
"testing"
7+
"time"
78

89
"github.com/deis/deis/tests/integration-utils"
910
"github.com/deis/deis/tests/utils"
@@ -12,7 +13,6 @@ import (
1213
func appsSetup(t *testing.T) *itutils.DeisTestConfig {
1314
cfg := itutils.GetGlobalConfig()
1415
cfg.AppName = "appssample"
15-
cfg.ExampleApp = itutils.GetRandomApp()
1616
cmd := itutils.GetCommand("auth", "login")
1717
itutils.Execute(t, cmd, cfg, false, "")
1818
cmd = itutils.GetCommand("git", "clone")
@@ -26,7 +26,7 @@ func appsCreateTest(t *testing.T, params *itutils.DeisTestConfig) {
2626
t.Fatalf("Failed:\n%v", err)
2727
}
2828
itutils.Execute(t, cmd, params, false, "")
29-
itutils.Execute(t, cmd, params, true, "Deis remote already exists")
29+
itutils.Execute(t, cmd, params, true, "App with this Id already exists")
3030

3131
if err := utils.Chdir(".."); err != nil {
3232
t.Fatalf("Failed:\n%v", err)
@@ -43,7 +43,7 @@ func appsRunTest(t *testing.T, params *itutils.DeisTestConfig) {
4343
if err := utils.Chdir(".."); err != nil {
4444
t.Fatalf("Failed:\n%v", err)
4545
}
46-
itutils.Execute(t, cmd, params, true, "Could not find deis remote in `git remote -v`")
46+
itutils.Execute(t, cmd, params, true, "Not found")
4747
}
4848

4949
func appsDestroyTest(t *testing.T, params *itutils.DeisTestConfig) {
@@ -73,6 +73,9 @@ func appsLogsTest(t *testing.T, params *itutils.DeisTestConfig) {
7373
t.Fatalf("Failed:\n%v", err)
7474
}
7575
itutils.Execute(t, cmd1, params, false, "")
76+
// TODO: nginx needs a few seconds to wake up here--fixme!
77+
time.Sleep(5000 * time.Millisecond)
78+
itutils.Curl(t, params)
7679
itutils.Execute(t, cmd, params, false, "")
7780
if err := utils.Chdir(".."); err != nil {
7881
t.Fatalf("Failed:\n%v", err)

tests/builds_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616

1717
func buildSetup(t *testing.T) *itutils.DeisTestConfig {
1818
cfg := itutils.GetGlobalConfig()
19-
cfg.ExampleApp = itutils.GetRandomApp()
2019
cfg.AppName = "buildsample"
2120
cmd := itutils.GetCommand("auth", "login")
2221
itutils.Execute(t, cmd, cfg, false, "")
@@ -58,8 +57,8 @@ func buildsListTest(t *testing.T, params *itutils.DeisTestConfig) {
5857
if stdout, _, err := utils.RunCommandWithStdoutStderr(cmdl); err != nil {
5958
t.Fatalf("Failed:\n%v", err)
6059
} else {
61-
ImageId := strings.Split(stdout.String(), "\n")[2]
62-
params.ImageId = strings.Fields(ImageId)[0]
60+
ImageID := strings.Split(stdout.String(), "\n")[2]
61+
params.ImageID = strings.Fields(ImageID)[0]
6362
}
6463

6564
}

tests/config_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212

1313
func configSetup(t *testing.T) *itutils.DeisTestConfig {
1414
cfg := itutils.GetGlobalConfig()
15-
cfg.ExampleApp = itutils.GetRandomApp()
1615
cfg.AppName = "configsample"
1716
cmd := itutils.GetCommand("auth", "login")
1817
itutils.Execute(t, cmd, cfg, false, "")

tests/dockercliutils/dockercliutils.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Package dockercliutils provides helper functions for testing with Docker.
2+
13
package dockercliutils
24

35
import (

tests/etcdutils/etcdutils.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Package etcdutils helps test interactions with etcd.
2+
13
package etcdutils
24

35
import (

0 commit comments

Comments
 (0)