github.com/deiscc/workflow-e2e@v0.0.0-20181208071258-117299af888f/README.md (about)

     1  
     2  |![](https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Warning.svg/156px-Warning.svg.png) | Deis Workflow will soon no longer be maintained.<br />Please [read the announcement](https://deis.cc/blog/2017/deis-workflow-final-release/) for more detail. |
     3  |---:|---|
     4  | 09/07/2017 | Deis Workflow [v2.18][] final release before entering maintenance mode |
     5  | 03/01/2018 | End of Workflow maintenance: critical patches no longer merged |
     6  
     7  # Deis Workflow End to End Tests v2
     8  
     9  [![Build Status](https://ci.deis.cc/job/workflow-e2e/badge/icon)](https://ci.deis.cc/job/workflow-e2e)
    10  [![Go Report Card](https://goreportcard.com/badge/github.com/deiscc/workflow-e2e)](https://goreportcard.com/report/github.com/deiscc/workflow-e2e)
    11  [![Docker Repository on Quay](https://quay.io/repository/deiscc/deis-e2e/status "Docker Repository on Quay")](https://quay.io/repository/deiscc/deis-e2e)
    12  
    13  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.
    14  
    15  For more information about the Deis Workflow, please visit the main project page at https://github.com/deiscc/workflow.
    16  
    17  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].
    18  
    19  # About
    20  
    21  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.
    22  
    23  # Development
    24  
    25  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.
    26  
    27  * Fork this repository
    28  * Make your changes
    29  * [Submit a pull request][prs] (PR) to this repository with your changes, and unit tests whenever possible.
    30    * 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)
    31  * 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
    32  
    33  ## Prerequisities
    34  
    35  Before you run the tests, you'll need a full Deis cluster up and running in Kubernetes. Follow the instructions [here](https://github.com/deiscc/charts#installation) to get one running.
    36  
    37  ## Run the Tests
    38  
    39  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.
    40  
    41  ### Remote Execution
    42  
    43  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:
    44  
    45  ```console
    46  $ export DEIS_CONTROLLER_URL=http://deis.your.cluster
    47  ```
    48  
    49  Tests execute in parallel by default. If you wish to control the number of executors, export a value for the `GINKGO_NODES` environment variable:
    50  
    51  ```console
    52  $ export GINKGO_NODES=5
    53  ```
    54  
    55  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.
    56  
    57  For reference, Workflow's own CI pipeline uses the following:
    58  
    59  | Test Nodes | Kubernetes Worker Nodes | Worker Node CPU | Worker Node Memory |
    60  |------------|-------------------------|-----------------|--------------------|
    61  | 5          | 3                       | 4 vCPUs         | 15 GB              |
    62  
    63  Setting the `GINKGO_NODES` environment variable to a value of `1` will allow serialized execution of all tests in the suite.
    64  
    65  #### Native Execution
    66  
    67  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`:
    68  
    69  ```console
    70  git clone git@github.com:deis/workflow-e2e.git $GOPATH/src/github.com/deiscc/workflow-e2e
    71  ```
    72  
    73  One-time execution of the following will resolve the test suite's own dependencies:
    74  
    75  ```console
    76  $ make bootstrap
    77  ```
    78  
    79  To execute the entire test suite:
    80  
    81  ```console
    82  $ make test-integration
    83  ```
    84  
    85  To run a single test or set of tests, you'll need the [Ginkgo](https://github.com/onsi/ginkgo) tool installed on your machine:
    86  
    87  ```console
    88  $ go get github.com/onsi/ginkgo/ginkgo
    89  ```
    90  
    91  You can then use the `--focus` option to run subsets of the test suite:
    92  
    93  ```console
    94  $ ginkgo --focus="deis apps" tests
    95  ```
    96  
    97  #### Containerized Execution
    98  
    99  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.
   100  
   101  In this case, you may clone this repository into a path of your own choosing (does not need to be on your `$GOPATH`):
   102  
   103  ```console
   104  git clone git@github.com:deis/workflow-e2e.git /path/of/your/choice
   105  ```
   106  
   107  Then build the test image and execute the test suite:
   108  
   109  ```console
   110  $ make docker-build docker-test-integration
   111  ```
   112  
   113  ### Within the Cluster
   114  
   115  A third option is to run the test suite from within the very cluster that is under test.
   116  
   117  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):
   118  
   119  ```console
   120  helm repo add workflow-e2e https://charts.deis.cc/workflow-e2e
   121  helm install --verify workflow-e2e/workflow-e2e --namespace deis
   122  ```
   123  
   124  To monitor tests as they execute:
   125  
   126  ```console
   127  $ kubectl --namespace=deis logs -f workflow-e2e tests
   128  ```
   129  
   130  ## Special Note on Resetting Cluster State
   131  
   132  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.)
   133  
   134  ```console
   135  $ kubectl exec -it deis-workflow-qoxhz python manage.py shell
   136  Python 2.7.10 (default, Aug 13 2015, 12:27:27)
   137  [GCC 4.9.2] on linux2
   138  >>> from django.contrib.auth import get_user_model
   139  >>> m = get_user_model()
   140  >>> m.objects.exclude(username='AnonymousUser').delete()
   141  >>> m.objects.all()
   142  ```
   143  
   144  Note that this is an ongoing issue for which we're planning [a more comprehensive fix](https://github.com/deiscc/workflow-e2e/issues/12).
   145  
   146  
   147  [install-k8s]: http://kubernetes.io/gettingstarted/
   148  [issues]: https://github.com/deiscc/workflow-e2e/issues
   149  [prs]: https://github.com/deiscc/workflow-e2e/pulls
   150  [v2.18]: https://github.com/deiscc/workflow/releases/tag/v2.18.0