| |
@@ -0,0 +1,68 @@
|
| |
+ .. _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 <http://frostyx.cz/posts/copr-stack-dockerized>`_.
|
| |
+
|
| |
+
|
| |
+ 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 `<http://127.0.0.1:5000/api/>`_. 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.
|
| |
+
|
| |
+ ::
|
| |
+
|
| |
+ 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] ./build-spec.sh
|
| |
+ [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
|
| |
+
|
| |
For the first time, I've tried to run Sanity tests against my local dev environment (docker-compose stack, to be precise). It is a pretty straightforward process, but there are few tricky parts. I feel that it should be described somewhere, so we can simply point people to it.
In case that we don't want to have it in the documentation, I can publish it as a blog post instead. However, I think that the documentation is a better place because it can be easily updated there.
Also, I am usually really verbose, but this article is kind of simple. I can add some words to it, but it looks good enough to me.