tests: introduce e2e suite (#422)
* mock: implement GetStatsSummary Signed-off-by: Paulo Pires <pjpires@gmail.com> * make: use skaffold to deploy vk Signed-off-by: Paulo Pires <pjpires@gmail.com> * test: add an e2e test suite Signed-off-by: Paulo Pires <pjpires@gmail.com> * test: add vendored code Signed-off-by: Paulo Pires <pjpires@gmail.com> * docs: update README.md Signed-off-by: Paulo Pires <pjpires@gmail.com> * ci: run e2e on circleci Signed-off-by: Paulo Pires <pjpires@gmail.com> * make: improve the skaffold target Signed-off-by: Paulo Pires <pjpires@gmail.com> * e2e: fix defer pod deletion Signed-off-by: Paulo Pires <pjpires@gmail.com> * e2e: improve instructions Signed-off-by: Paulo Pires <pjpires@gmail.com> * makefile: default shell is bash Signed-off-by: Paulo Pires <pjpires@gmail.com>
This commit is contained in:
62
README.md
62
README.md
@@ -27,6 +27,8 @@ The best description is "Kubernetes API on top, programmable back."
|
||||
+ [Service Fabric Mesh Provider](#service-fabric-mesh-provider)
|
||||
+ [Adding a New Provider via the Provider Interface](#adding-a-new-provider-via-the-provider-interface)
|
||||
* [Testing](#testing)
|
||||
+ [Unit tests](#unit-tests)
|
||||
+ [End-to-end tests](#end-to-end-tests)
|
||||
+ [Testing the Azure Provider Client](#testing-the-azure-provider-client)
|
||||
* [Known quirks and workarounds](#known-quirks-and-workarounds)
|
||||
* [Contributing](#contributing)
|
||||
@@ -238,8 +240,68 @@ type PodMetricsProvider interface {
|
||||
|
||||
## Testing
|
||||
|
||||
### Unit tests
|
||||
|
||||
Running the unit tests locally is as simple as `make test`.
|
||||
|
||||
### End-to-end tests
|
||||
|
||||
Virtual Kubelet includes an end-to-end (e2e) test suite which is used to validate its implementation.
|
||||
The current e2e suite **does not** run for any providers other than the `mock` provider.
|
||||
|
||||
To run the e2e suite, three things are required:
|
||||
- a local Kubernetes cluster (we have tested with [Docker for Mac](https://docs.docker.com/docker-for-mac/install/) and [Minikube](https://github.com/kubernetes/minikube));
|
||||
- Your _kubeconfig_ default context points to the local Kubernetes cluster;
|
||||
- [`skaffold`](https://github.com/GoogleContainerTools/skaffold).
|
||||
|
||||
Since our CI uses Minikube, we describe below how to run e2e on top of it.
|
||||
|
||||
To create a Minikube cluster, run the following command after [installing Minikube](https://github.com/kubernetes/minikube#installation):
|
||||
|
||||
```console
|
||||
$ minikube start
|
||||
```
|
||||
|
||||
The e2e suite requires Virtual Kubelet to be running as a pod inside the Kubernetes cluster.
|
||||
To make the deployment process easier, the build toolchain leverages on `skaffold`.
|
||||
|
||||
In order to deploy the Virtual Kubelet, run the following command after [installing `skaffold`](https://github.com/GoogleContainerTools/skaffold#installation):
|
||||
|
||||
```console
|
||||
$ make skaffold
|
||||
```
|
||||
|
||||
By default, this will run `skaffold` in [_development_ mode](https://github.com/GoogleContainerTools/skaffold#skaffold-dev).
|
||||
This will make `skaffold` watch `hack/skaffold/virtual-kubelet/Dockerfile` and its dependencies for changes and re-deploy the Virtual Kubelet when said changes happen.
|
||||
It will also make `skaffold` stream logs from the Virtual Kubelet pod.
|
||||
|
||||
As an alternative, and if you are not concerned about continuous deployment and log streaming, you can run the following command instead:
|
||||
|
||||
```console
|
||||
$ make skaffold MODE=run
|
||||
```
|
||||
|
||||
This will deploy the Virtual Kubelet and return immediately.
|
||||
|
||||
To run the e2e test suite, you can now run the following command:
|
||||
|
||||
```console
|
||||
$ make e2e
|
||||
```
|
||||
|
||||
When you're done testing, you can run the following command to cleanup the resources created by `skaffold`:
|
||||
|
||||
```console
|
||||
$ make skaffold MODE=delete
|
||||
```
|
||||
|
||||
Please note that this will not unregister the Virtual Kubelet as a node in the Kubernetes cluster.
|
||||
In order to do so, you should run:
|
||||
|
||||
```console
|
||||
$ kubectl delete node vkubelet-mock-0
|
||||
```
|
||||
|
||||
### Testing the Azure Provider Client
|
||||
|
||||
The unit tests for the [`azure`](providers/azure/) provider require a `credentials.json`
|
||||
|
||||
Reference in New Issue
Block a user