diff options
author | baude <bbaude@redhat.com> | 2018-02-08 10:40:43 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2018-02-08 12:37:07 -0600 |
commit | c089cb9c9270aa4b367deb8c8c03cb05f8860a33 (patch) | |
tree | 8d765658f757798e1578fd2fc96f1528e6af5e20 /test/README.md | |
parent | 8fdccb77648f5b772c6bae98fce4734b1a54ed4a (diff) | |
download | podman-c089cb9c9270aa4b367deb8c8c03cb05f8860a33.tar.gz podman-c089cb9c9270aa4b367deb8c8c03cb05f8860a33.tar.bz2 podman-c089cb9c9270aa4b367deb8c8c03cb05f8860a33.zip |
Final ginkgo migration
Completion of the migration from bats to ginkgo. This includes:
* load
* mount
* pause
* port
* run_networking
* search
Note: build will be done within a different PR
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'test/README.md')
-rw-r--r-- | test/README.md | 115 |
1 files changed, 34 insertions, 81 deletions
diff --git a/test/README.md b/test/README.md index 1dd2e3c76..78fb52cab 100644 --- a/test/README.md +++ b/test/README.md @@ -1,106 +1,59 @@ -# CRIO Integration Tests +# Integration testing -Integration tests provide end-to-end testing of CRIO. +Our primary means of performing integration testing for libpod is with the +[Ginkgo](https://github.com/onsi/ginkgo) BDD testing framework. This allows +us to use native Golang to perform our tests and there is a strong affiliation +between Ginkgo and the Go test framework. -Note that integration tests do **not** replace unit tests. +## Installing dependencies +The dependencies for integration really consists of three things: +* ginkgo binary +* ginkgo sources +* gomega sources -As a rule of thumb, code should be tested thoroughly with unit tests. -Integration tests on the other hand are meant to test a specific feature end -to end. +The following instructions assume your GOPATH is ~/go. Adjust as needed for your +environment. -Integration tests are written in *bash* using the -[bats](https://github.com/sstephenson/bats) framework. - -## Running integration tests - -### Containerized tests - -The easiest way to run integration tests is with Docker: +### Installing ginko +Fetch and build ginkgo with the following command: ``` -$ make integration +GOPATH=~/go go get -u github.com/onsi/ginkgo/ginkgo ``` - -To run a single test bucket: +Now install the ginkgo binary into your path: ``` -$ make integration TESTFLAGS="runtimeversion.bats" +install -D -m 755 "$GOPATH"/bin/ginkgo /usr/bin/ ``` +You now have a ginkgo binary and its sources in your GOPATH. -### On your host - -To run the integration tests on your host, you will first need to setup a development environment plus -[bats](https://github.com/sstephenson/bats#installing-bats-from-source) -For example: +### Install gomega sources +The gomega sources can be simply installed with the command: ``` -$ cd ~/go/src/github.com -$ git clone https://github.com/sstephenson/bats.git -$ cd bats -$ ./install.sh /usr/local +GOPATH=~/go go get github.com/onsi/gomega/... ``` -You will also need to install the [CNI](https://github.com/containernetworking/cni) plugins as -the the default pod test template runs without host networking: +### Running the integration tests -``` -$ go get github.com/containernetworking/cni -$ cd "$GOPATH/src/github.com/containernetworking/cni" -$ git checkout -q d4bbce1865270cd2d2be558d6a23e63d314fe769 -$ ./build.sh \ -$ mkdir -p /opt/cni/bin \ -$ cp bin/* /opt/cni/bin/ -``` +You can run the entire suite of integration tests with the following command: -Then you can run the tests on your host: ``` -$ sudo make localintegration +GOPATH=~/go ginkgo -v tests/e2e/. ``` -To run a single test bucket: -``` -$ make localintegration TESTFLAGS="runtimeversion.bats" -``` +Note the trailing period on the command above. Also, **-v** invokes verbose mode. That +switch is optional. + +You can run a single file of integration tests using the go test command: -Or you can just run them directly using bats ``` -$ sudo bats test +GOPATH=~/go go test -v tests/e2e/libpod_suite_test.go tests/e2e/your_test.go ``` -#### Runtime selection -Tests on the host will run with `runc` as the default runtime. -However you can select other OCI compatible runtimes by setting -the `RUNTIME` environment variable. - -For example one could use the [Clear Containers](https://github.com/01org/cc-oci-runtime/wiki/Installation) -runtime instead of `runc`: +#### Run all tests like PAPR +You can closely emulate the PAPR run for Fedora with the following command: ``` -make localintegration RUNTIME=cc-oci-runtime +make integration.fedora ``` -## Writing integration tests - -[Helper functions] -(https://github.com/kubernetes-incubator/crio/blob/master/test/helpers.bash) -are provided in order to facilitate writing tests. - -```sh -#!/usr/bin/env bats - -# This will load the helpers. -load helpers - -# setup is called at the beginning of every test. -function setup() { -} - -# teardown is called at the end of every test. -function teardown() { - cleanup_test -} - -@test "crioctl runtimeversion" { - start_crio - crioctl runtimeversion - [ "$status" -eq 0 ] -} - -``` +This will run lint, git-validation, and gofmt tests and then execute unit and integration +tests as well. |