Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/deis/workflow-e2e

End-to-end tests for Deis Workflow
https://github.com/deis/workflow-e2e

deis-workflow end-to-end-testing ginkgo k8s kubernetes unsupported

Last synced: 9 days ago
JSON representation

End-to-end tests for Deis Workflow

Awesome Lists containing this project

README

        

|![](https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Warning.svg/156px-Warning.svg.png) | Deis Workflow is no longer maintained.
Please [read the announcement](https://deis.com/blog/2017/deis-workflow-final-release/) for more detail. |
|---:|---|
| 09/07/2017 | Deis Workflow [v2.18][] final release before entering maintenance mode |
| 03/01/2018 | End of Workflow maintenance: critical patches no longer merged |
| | [Hephy](https://github.com/teamhephy/workflow) is a fork of Workflow that is actively developed and accepts code contributions. |

# Deis Workflow End to End Tests v2

[![Build Status](https://ci.deis.io/job/workflow-e2e/badge/icon)](https://ci.deis.io/job/workflow-e2e)
[![Go Report Card](https://goreportcard.com/badge/github.com/deis/workflow-e2e)](https://goreportcard.com/report/github.com/deis/workflow-e2e)
[![Docker Repository on Quay](https://quay.io/repository/deisci/deis-e2e/status "Docker Repository on Quay")](https://quay.io/repository/deisci/deis-e2e)

Deis (pronounced DAY-iss) Workflow is an open source Platform as a Service (PaaS) that adds a developer-friendly layer to any [Kubernetes](http://kubernetes.io) cluster, making it easy to deploy and manage applications on your own servers.

For more information about the Deis Workflow, please visit the main project page at https://github.com/deis/workflow.

We welcome your input! If you have feedback, please [submit an issue][issues]. If you'd like to participate in development, please read the "Development" section below and [submit a pull request][prs].

# About

The code in this repository is a set of [Ginkgo](http://onsi.github.io/ginkgo) and [Gomega](http://onsi.github.io/gomega) based integration tests that execute commands against a running Deis cluster using the Deis CLI.

# Development

The Deis project welcomes contributions from all developers. The high level process for development matches many other open source projects. See below for an outline.

* Fork this repository
* Make your changes
* [Submit a pull request][prs] (PR) to this repository with your changes, and unit tests whenever possible.
* If your PR fixes any [issues][issues], make sure you write Fixes #1234 in your PR description (where #1234 is the number of the issue you're closing)
* The Deis core contributors will review your code. After each of them sign off on your code, they'll label your PR with LGTM1 and LGTM2 (respectively). Once that happens, the contributors will merge it

## Prerequisities

Before you run the tests, you'll need a full Deis cluster up and running in Kubernetes. Follow the instructions [here](https://github.com/deis/charts#installation) to get one running.

## Run the Tests

There are three options for how to execute the tests. These include two options for executing the tests against Deis Workflow installed on a _remote_ Kubernetes cluster, and one option for installing the same tests directly into a Kubernetes cluster and executing them there.

### Remote Execution

Either of two options for remote execution of the test suite require the `DEIS_CONTROLLER_URL` environment variable to be exported. Its value should be the the controller endpoint you would normally use with the `deis register` or `deis login` commands:

```console
$ export DEIS_CONTROLLER_URL=http://deis.your.cluster
```

Tests execute in parallel by default. If you wish to control the number of executors, export a value for the `GINKGO_NODES` environment variable:

```console
$ export GINKGO_NODES=5
```

If this is not set, Ginkgo will automatically choose a number of test nodes (executors) based on the number of CPU cores _on the machine executing the tests_. It is important to note, however, that test execution is constrained more significantly by the resources of the cluster under test than by the resources of the machine executing the tests. The number of test nodes, therefore, should be explicitly set and scaled in proportion to the resources available in the cluster.

For reference, Workflow's own CI pipeline uses the following:

| Test Nodes | Kubernetes Worker Nodes | Worker Node CPU | Worker Node Memory |
|------------|-------------------------|-----------------|--------------------|
| 5 | 3 | 4 vCPUs | 15 GB |

Setting the `GINKGO_NODES` environment variable to a value of `1` will allow serialized execution of all tests in the suite.

#### Native Execution

If you have Go 1.5 or greater already installed and working properly and also have the [Glide](https://github.com/Masterminds/glide) dependency management tool for Go installed, you may clone this repository into your `$GOPATH`:

```console
git clone [email protected]:deis/workflow-e2e.git $GOPATH/src/github.com/deis/workflow-e2e
```

One-time execution of the following will resolve the test suite's own dependencies:

```console
$ make bootstrap
```

To execute the entire test suite:

```console
$ make test-integration
```

To run a single test or set of tests, you'll need the [Ginkgo](https://github.com/onsi/ginkgo) tool installed on your machine:

```console
$ go get github.com/onsi/ginkgo/ginkgo
```

You can then use the `--focus` option to run subsets of the test suite:

```console
$ ginkgo --focus="deis apps" tests
```

#### Containerized Execution

If you do not have Go 1.5 or greater installed locally, but do have a Docker daemon running locally (or are using docker-machine), you can quite easily execute tests against a remote cluster from within a container.

In this case, you may clone this repository into a path of your own choosing (does not need to be on your `$GOPATH`):

```console
git clone [email protected]:deis/workflow-e2e.git /path/of/your/choice
```

Then build the test image and execute the test suite:

```console
$ make docker-build docker-test-integration
```

### Within the Cluster

A third option is to run the test suite from within the very cluster that is under test.

To install the [helm](https://github.com/kubernetes/helm) chart and start the tests, assuming helm and its corresponding server component tiller are [installed](https://github.com/kubernetes/helm/blob/master/docs/install.md):

```console
helm repo add workflow-e2e https://charts.deis.com/workflow-e2e
helm install --verify workflow-e2e/workflow-e2e --namespace deis
```

To monitor tests as they execute:

```console
$ kubectl --namespace=deis logs -f workflow-e2e tests
```

## Special Note on Resetting Cluster State

All tests clean up after themselves, however, in the case of test failures or interruptions, automatic cleanup may not always proceed as intended. This may leave projects, users or other state behind, which may impact future executions of the test suite against the same cluster. (Often all tests will fail.) If you see this behavior, run these commands to clean up. (Replace `deis-workflow-qoxhz` with the name of the deis/workflow pod in your cluster.)

```console
$ kubectl exec -it deis-workflow-qoxhz python manage.py shell
Python 2.7.10 (default, Aug 13 2015, 12:27:27)
[GCC 4.9.2] on linux2
>>> from django.contrib.auth import get_user_model
>>> m = get_user_model()
>>> m.objects.exclude(username='AnonymousUser').delete()
>>> m.objects.all()
```

Note that this is an ongoing issue for which we're planning [a more comprehensive fix](https://github.com/deis/workflow-e2e/issues/12).

[install-k8s]: http://kubernetes.io/gettingstarted/
[issues]: https://github.com/deis/workflow-e2e/issues
[prs]: https://github.com/deis/workflow-e2e/pulls
[v2.18]: https://github.com/deis/workflow/releases/tag/v2.18.0