-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ozdanborne/solo-tests
Run e2e's as standalone
- Loading branch information
Showing
7 changed files
with
1,663 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
bin | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,68 @@ | ||
# I Containerized the k8s e2e's. | ||
# Containerized Kubernetes e2e's | ||
|
||
[![Docker Pulls](https://img.shields.io/docker/pulls/ozdanborne/k8s-e2e.svg)](https://hub.docker.com/r/ozdanborne/k8s-e2e/) | ||
|
||
#### Usage | ||
|
||
#### How to run the k8s-e2e's before I containerized them: | ||
If your k8s-apiserver is running at `localhost:8080` with no auth: | ||
|
||
Step 1: **Build Kubernetes**. | ||
|
||
Step 2: Run the Kubernetes End-to-End Tests. | ||
``` | ||
docker run --net=host ozdanborne/k8s-e2e | ||
``` | ||
|
||
#### How to run the k8s-e2e's now that I containerized them: | ||
Otherwise, volume mount your own kubeconfig: | ||
|
||
Step 1: Run the Kubernetes End-to-End Tests. | ||
```bash | ||
docker run --net=host -v ~/.kube/config:/root/kubeconfig ozdanborne/k8s-e2e | ||
``` | ||
|
||
Step 2: Congratulate yourself on not even having to build Kubernetes first. | ||
###### Configure ginkgo.focus | ||
|
||
### You too can run the k8s-e2e's on your cluster without having to build Kubernetes first. | ||
``` | ||
docker run --net=host -e FOCUS='Conformance' ozdanborne/k8s-e2e | ||
``` | ||
|
||
#### Run using Docker | ||
###### XML Results | ||
|
||
To run the e2e's using Docker, volume mount in a populated kubeconfig: | ||
XML test results will be output to `/result` in the container. Volume mount this | ||
directory onto the host to view results once the container has finished: | ||
|
||
```docker run --net=host ozdanborne/k8s-e2e | ||
docker run --net=host -v ./result:/result ozdanborne/k8s-e2e | ||
``` | ||
docker run -v ~/.kube/config:/root/kubeconfig ozdanborne/k8s-e2e | ||
``` | ||
|
||
If your apiserver is running at `localhost:8080` with no auth, you can | ||
rely on [the default kubeconfig already at `/root/kubeconfig`](https://github.com/ozdanborne/k8s-e2e-containerized/blob/run-as-plain-container/kubeconfig). | ||
#### Building | ||
|
||
###### Docker Image | ||
|
||
``` | ||
docker run --net=host ozdanborne/k8s-e2e | ||
docker build -t ozdanborne/k8s-e2e:dev . | ||
``` | ||
|
||
#### Run using Kubernetes | ||
> Docker builds use multi-stage builds and do not leave a binary on the host. If you need a binary on the host, you must manually build it (see next section). | ||
You can also run the e2e's as a Kubernetes pod by overriding the default | ||
command with one which leaves out `-kubeconfig`. When omitted, the e2e's will | ||
rely on the `KUBERNETES_SERVICE_HOST` and `KUBERNETES_SERVICE_PORT` which | ||
are set for every pod: | ||
###### Binary | ||
|
||
``` | ||
kubectl run e2e --image=ozdanborne/k8s-e2e --restart=Never --attach -- ./e2e.test --ginkgo.focus="(Networking).*(\[Conformance\])|\[Feature:NetworkPolicy\]" | ||
``` | ||
1. Install glide dependencies: | ||
|
||
### Test Results XML | ||
``` | ||
glide install -v | ||
``` | ||
|
||
XML test results will be output to `/result` in the container. Volume mount this | ||
directory onto the host to view results once the container has finished. | ||
2. Generate go-bindata for Kubernetes: | ||
|
||
``` | ||
pushd vendor/k8s.io/kubernetes | ||
go-bindata \ | ||
-pkg generated -ignore .jpg -ignore .png -ignore .md \ | ||
./examples/* ./docs/user-guide/* test/e2e/testing-manifests/kubectl/* test/images/* | ||
mv bindata.go test/e2e/generated | ||
popd | ||
``` | ||
|
||
## Future Work | ||
3. Build e2e.test | ||
|
||
**Pass Target Apiserver as Param** | ||
``` | ||
go test -o e2e.test -c . | ||
``` | ||
|
||
It'd be useful to accept an apiserver address as a param at runtime. | ||
Unfortunately, I couldn't get `e2e.test` to use the `-host` passed to it. |
Oops, something went wrong.