Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
add e2e tests to run on cluster
Browse files Browse the repository at this point in the history
Run e2e tests using:

```
make test-e2e
```

The tests run in parallel so you might want to rate limit on number
of tests that run in parallel, you can do that by running following:

```
make test-e2e PARALLEL=2
```

Above will run only two tests in parallel.
  • Loading branch information
surajssd committed Aug 31, 2017
1 parent fb62d5f commit 676ac66
Show file tree
Hide file tree
Showing 6 changed files with 422 additions and 4 deletions.
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
GITCOMMIT := $(shell git rev-parse --short HEAD)
BUILD_FLAGS := -ldflags="-w -X github.com/kedgeproject/kedge/cmd.GITCOMMIT=$(GITCOMMIT)"
PKGS = $(shell glide novendor)
UNITPKGS = $(shell glide novendor | grep -v tests)

default: bin

Expand Down Expand Up @@ -52,7 +53,16 @@ check-vendor:

.PHONY: test-unit
test-unit:
go test $(PKGS)
go test $(UNITPKGS)

.PHONY: test-e2e
test-e2e:

ifdef PARALLEL
go test -parallel=$(PARALLEL) -v github.com/kedgeproject/kedge/tests/e2e
else
go test -v github.com/kedgeproject/kedge/tests/e2e
endif

# Run all tests
.PHONY: test
Expand All @@ -78,6 +88,6 @@ test-unit-cover:
go test -i -race -cover $(PKGS)
# go test doesn't support colleting coverage across multiple packages,
# generate go test commands using go list and run go test for every package separately
go list -f '"go test -race -cover -v -coverprofile={{.Dir}}/.coverprofile {{.ImportPath}}"' github.com/kedgeproject/kedge/... | grep -v "vendor" | xargs -L 1 -P4 sh -c
go list -f '"go test -race -cover -v -coverprofile={{.Dir}}/.coverprofile {{.ImportPath}}"' github.com/kedgeproject/kedge/... | grep -v "vendor" | grep -v "e2e" | xargs -L 1 -P4 sh -c


27 changes: 27 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,30 @@ by one incrementally so that it is easy to review and going back and forth on
it is easier.

**Note**: Above guidelines are not hard rules use those with discretion

### Running tests

#### Run all tests except end-to-end tests

```bash
make test
```

#### Run end-to-end tests

Before running end to end tests locally make sure [minikube](https://github.com/kubernetes/minikube/)
is running.

```bash
make bin
make test-e2e
```

**Note**: When you run end to end tests, those tests are run in parallel. If
you are low on resources you can limit number of tests that run in parallel by
doing following:

```bash
make test-e2e PARALLEL=4
```

6 changes: 6 additions & 0 deletions docs/examples/extraResources/app.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: web
containers:
- image: centos/httpd
health:
httpGet:
path: /
port: 80
initialDelaySeconds: 10
timeoutSeconds: 5
volumeMounts:
- name: web
mountPath: /var/www/html/
Expand Down
4 changes: 3 additions & 1 deletion examples/wordpress/wordpress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ containers:
httpGet:
path: /
port: 80
initialDelaySeconds: 20
timeoutSeconds: 5

services:
- name: wordpress
type: LoadBalancer
ports:
- port: 80
- port: 80
2 changes: 1 addition & 1 deletion scripts/check-vendor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function check_glide-vc() {
echo "Checking if vendor was cleaned using glide-vc."

# dry run glide-vc and count how many could be deleted.
NO_DELETED_FILES=$(glide-vc --only-code --no-tests --dryrun | wc -l)
NO_DELETED_FILES=$(glide-vc --only-code --no-tests --use-lock-file --dryrun | wc -l)

if [ $NO_DELETED_FILES -ne 0 ]; then
echo "ERROR"
Expand Down
Loading

0 comments on commit 676ac66

Please sign in to comment.