From 29e8c9616288d9c71f9bc0852a183ca1453d073d Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 15 Dec 2017 00:25:16 +0100 Subject: [PATCH] TT#26206 Provide README for working with tests Especially when working on tests for new features it's useful to run ngcpcfg and pytest interchangeably. Since identifying all relevant variables is annoying let's provide an example command line that's known to being useful while working on the "ngcpcfg patch" tests. Change-Id: I1ae1499ba2607f553d1dddcb355c7a3758d1a844 --- t/README.adoc | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 t/README.adoc diff --git a/t/README.adoc b/t/README.adoc new file mode 100644 index 00000000..050733c1 --- /dev/null +++ b/t/README.adoc @@ -0,0 +1,35 @@ +README +====== + +Purpose of this directory +------------------------- + +This directory provides system tests for ngcpcfg, using pytest (a mature full-featured Python testing tool). + +Tips for working with tests +--------------------------- + +If you're working on a new feature, try to simulate a specific behavior, or need to run ngcpcfg for any other reason, +you might need to run ngcpcfg with a certain environment. +This can be achieved by injecting according environment variables to ngcpcfg. +The following command line provides an example invocation: + +[source,bash] +cd t # we're assuming in the following command line that you're inside this testing folder +HELPER=../helper CONFIG_POOL=/etc/ NGCPCFG=./fixtures/ngcpcfg.cfg SCRIPTS=../scripts/ FUNCTIONS=../functions/ \ +NGCP_BASE_TT2=/tmp/pytest-of-root/pytest-XX/test_YYY/ NGCP_PORTFILE=/tmp/ngcpcfg.port OUTPUT_DIRECTORY=/tmp/ \ +TEMPLATE_POOL_BASE=/tmp/pytest-of-root/pytest-XX/test_YYY ../sbin/ngcpcfg [...] + +Test runs +---------- + +It's recommended to run the tests inside a docker container (see Dockerfile for usage instructions). +Running all available tests from inside the ``t`` directory then is as simple as: + +[source,bash] +py.test-3 -v + +To run only the tests matching 'test_patch_action' execute: + +[source,bash] +py.test-3 -v -k test_patch_action