#233 [doc] describe how to run sanity tests against docker stack
Merged 6 years ago by frostyx. Opened 6 years ago by frostyx.
copr/ frostyx/copr doc-sanity-docker-compose  into  master

@@ -51,3 +51,8 @@ 

  .. 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`

file added
+68
@@ -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.

Nit, can you set tw=80 :-) it is pretty hard to follow the long lines :-)

Thanks! It is really helpful. In future, I would love to see the docker-compose-up
instructions baked into the docs too (reference to blog is fine, but the base steps
would be nice to have offline in git).

Nit, can you set tw=80 :-) it is pretty hard to follow the long lines :-)

Ok, next time I will wrap it :-). I usually do :set wrap and didn't realize that you have no way how to do it in the browser.

Thanks! It is really helpful. In future, I would love to see the docker-compose-up
instructions baked into the docs too (reference to blog is fine, but the base steps
would be nice to have offline in git).

So far the blog post link will have to be enough, because it is the only article about docker-compose stack, that we have. But yes, having it described in docs one time is a good goal.

This is a bit too verbose sentence, I think.

I would recommend to start with some quicker test first (e.g. upload_authentication.sh). Something that would quickly test if the setup is correct. We could even have a test called 'test-setup.sh').

I have some notes but only minor ones. I would already start preparing ourselves to actually use ansible-container for the container setup. But the docs might be updated about this later (we need to prepare it first).

2 new commits added

  • [doc] shorten the sentence
  • [doc] suggest some quick test first
6 years ago

Thanks for the feedback.

This is a bit too verbose sentence, I think.

I've shortened the sentence. The explanation of why the variable needs to be changed wasn't really necessary.

I would recommend to start with some quicker test first (e.g. upload_authentication.sh). Something that would quickly test if the setup is correct.

This is a good idea, I've recommended build-spec.sh though. It is even shorter.

This is a good idea, I've recommended build-spec.sh though. It is even shorter.

build-spec.sh is shorter but it takes a long time to build that package. But I guess, I can just make that build faster :).

Pull-Request has been merged by frostyx

6 years ago