Skip to content

Commit

Permalink
refactored tests to use golang testing
Browse files Browse the repository at this point in the history
This PR refactors the E2E tests to use the standard `go test` runner.
That allows us to use standard tooling for error handling, parallelism,
skipping and failing tests and so on. It can be executed like so:

```
go test --kubernikus kubernikus.eu-nl-1.cloud.sap --kluster demo -v --cleanup=false --reuse
```

It is now possible to pass `--kluster` flag to specify the name of
a kluster. If omitted a random name is generated. It is useful in
combination with `--reuse` that skips Kluster creation and tries to use
and existing kluster with given name.

To easy with cleanup and running tests against the same kluster multiple
times, all test objects like pods and services are created in a unique
namespace.

There's also a `--cleanup` flag. It allows to skip the cleanup steps.

I ran with the idea to order the tests manually. So, we have a single
Test that runs all over tests in a predefined order. It goes against the
pure philosophy but works.

Also, all setup and cleanup methods are also tests. Mainly for the
reason that it can be parallelised and grouped easily.

The `exec` functionality has been "migrated" from the kubernetes/e2e
suite. We don't need to shell-out to `kubectl` anymore.

The Authentication against Kubernikus (Openstack) and the Kubernetes
Kluster has been refactored into the `framework` package. Wherever we
need to wait and timeout the `client-go`'s wait package is being used.

All global state is gone. The framworks are initialised from flags and
ENV in the setup `TestRunner` and passed to structs for each "suite" of
tests.
  • Loading branch information
BugRoger committed May 14, 2018
1 parent 6b4bed1 commit 150920a
Show file tree
Hide file tree
Showing 41 changed files with 2,457 additions and 1,742 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ clean:

.PHONY: test-e2e
test-e2e:
./test/e2e/test.sh $@
@cd test/e2e && \
set -o pipefail && \
go test -v --kubernikus=kubernikus.eu-nl-1.cloud.sap | \
grep -v "CONT\|PAUSE"


include code-generate.mk
code-gen: client-gen informer-gen lister-gen deepcopy-gen
Expand Down
1 change: 1 addition & 0 deletions deps/deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
_ "github.com/stretchr/testify/assert"
_ "github.com/stretchr/testify/require"
_ "github.com/stretchr/testify/mock"
_ "github.com/stretchr/testify/suite"
_ "k8s.io/client-go/kubernetes/fake"
_ "k8s.io/code-generator/cmd/client-gen"
_ "k8s.io/code-generator/cmd/informer-gen"
Expand Down
199 changes: 0 additions & 199 deletions test/e2e/APITests.go

This file was deleted.

64 changes: 0 additions & 64 deletions test/e2e/README.md

This file was deleted.

Loading

0 comments on commit 150920a

Please sign in to comment.