From 72fc4cf987481ef6480629b7442c36121bb148a3 Mon Sep 17 00:00:00 2001 From: Jakub Kadlčík Date: Feb 19 2018 23:08:22 +0000 Subject: [PATCH 1/3] [doc] describe how to run sanity tests against docker stack --- diff --git a/doc/developer_documentation.rst b/doc/developer_documentation.rst index 902bb86..6282e48 100644 --- a/doc/developer_documentation.rst +++ b/doc/developer_documentation.rst @@ -51,3 +51,8 @@ Here is an example of how building process goes (for the simplest case of SRPM b .. image:: _static/srpm-build.jpeg Note that we need to figure out whether CoprDistGit is actually still needed in the COPR architecture. That's why the lines are dotted there. It is still present in the current architecture though. + +Integration tests +----------------- + +* :ref:`sanity_tests` diff --git a/doc/sanity_tests.rst b/doc/sanity_tests.rst new file mode 100644 index 0000000..9ddbb13 --- /dev/null +++ b/doc/sanity_tests.rst @@ -0,0 +1,67 @@ +.. _sanity_tests: + + +Running Sanity tests against local dev instance +=============================================== + +When implementing a new feature, you might be asked to write a beaker-tests for it. Sanity tests are usually run against the copr-fe-dev instance, which is a problem when you don't have access to it. This article describes how to run Sanity tests against the `local docker-compose dev environment `_. + + +DockerTestEnv container +----------------------- + +Our beaker tests can change the filesystem so we strongly discourage you from running them on your host system. There is a docker container for this purpose. Follow these instructions to building it, running it and executing a shell in it. + + +:: + + # In Copr git repository + cd ./beaker-tests/DockerTestEnv + + # Build and run the docker container for executing beaker-tests + make build && make run + + # Join the network created by docker-compose + # You can skip this step when running tests against + # copr-fe-dev or another personal instance + docker network connect copr_default test-env + + # Open a shell in it + make sh + + +API token +--------- + +Now we are going to operate in the container. + +:: + + # Install dependencies and configure copr-cli + [root@test-env ~] cd ~/copr/beaker-tests/Install/Config-copr-cli + [root@test-env Config-copr-cli] ./runtest.sh + + # Set your API token and Copr URL + [root@test-env ~] vim ~/.config/copr + +Find the token here ``_. Simply remove the existing content of ``~/.config/copr`` and put your token there. The only thing that needs to be changed is ``copr_url`` - it can't be set to ``http://localhost:5000``. That URL is for communicating with frontend from your host system. The ``127.0.0.1`` in the test container refers to localhost of that particular container on which obviously nothing listens. It should be set this way. + +:: + + copr_url = http://frontend + +We have already connected this container to the network created by docker-compose, so we can communicate with the frontend like this ``curl frontend``. + + +Running the tests +----------------- + +:: + + [root@test-env ~] cd ~/copr/beaker-tests/Sanity/copr-cli-basic-operations/ + [root@test-env copr-cli-basic-operations] ./runtest.sh + [root@test-env copr-cli-basic-operations] ./runtest-modules.sh + + # To see all the test scripts + [root@test-env copr-cli-basic-operations] ls *.sh + From cbda0361ef378c94d2a45f4fae69138300a4a076 Mon Sep 17 00:00:00 2001 From: Jakub Kadlčík Date: Feb 21 2018 10:29:49 +0000 Subject: [PATCH 2/3] [doc] suggest some quick test first --- diff --git a/doc/sanity_tests.rst b/doc/sanity_tests.rst index 9ddbb13..44200fe 100644 --- a/doc/sanity_tests.rst +++ b/doc/sanity_tests.rst @@ -59,6 +59,7 @@ Running the tests :: [root@test-env ~] cd ~/copr/beaker-tests/Sanity/copr-cli-basic-operations/ + [root@test-env copr-cli-basic-operations] ./build-spec.sh [root@test-env copr-cli-basic-operations] ./runtest.sh [root@test-env copr-cli-basic-operations] ./runtest-modules.sh From 4d02962533d287ef01cdfc2381e019228fa314b6 Mon Sep 17 00:00:00 2001 From: Jakub Kadlčík Date: Feb 21 2018 11:13:20 +0000 Subject: [PATCH 3/3] [doc] shorten the sentence --- diff --git a/doc/sanity_tests.rst b/doc/sanity_tests.rst index 44200fe..d34b069 100644 --- a/doc/sanity_tests.rst +++ b/doc/sanity_tests.rst @@ -44,7 +44,7 @@ Now we are going to operate in the container. # Set your API token and Copr URL [root@test-env ~] vim ~/.config/copr -Find the token here ``_. Simply remove the existing content of ``~/.config/copr`` and put your token there. The only thing that needs to be changed is ``copr_url`` - it can't be set to ``http://localhost:5000``. That URL is for communicating with frontend from your host system. The ``127.0.0.1`` in the test container refers to localhost of that particular container on which obviously nothing listens. It should be set this way. +Find the token here ``_. Simply remove the existing content of ``~/.config/copr`` and put your token there. The only thing that needs to be changed is ``copr_url``. It should be set this way. ::