getavalon / docker

Avalon in a Dockerfile
MIT License
5 stars 2 forks source link

Tests #16

Closed tokejepsen closed 6 years ago

tokejepsen commented 6 years ago

Goal

Have CI run tests, to ensure quality of code logic in this repository.

tokejepsen commented 6 years ago

I'm currently looking it this, but struggling a bit on how to set this up. The problem comes down the testing the Docker container under different cases, for example I would like to test the backup/restore logic by;

  1. Start the container.
  2. Importing a project.
  3. Backup project.
  4. Kill the container.
  5. Start an empty container.
  6. Restore project to the empty container.

Is this the right way of thinking about testing the code in this repository?

mottosso commented 6 years ago

I think that could work, but I think a more sustainable approach would be too boot up the Docker container once, and run the tests while it's running.

  1. Start the container
  2. Per test:
    1. Create a project, need only be a few lines and avoids reaching for anything external
    2. Backup
    3. Verify
    4. Clean-up (if necessary)
tokejepsen commented 6 years ago

I found it difficult to run the avalon executable through Docker Toolbox. Since the linux part of the distribution does not have any of the required modules, like pymongo and PyQt5, you end up having to install everything for tests.

The other option is to run the tests through cmd.exe, but the docker commands do not like that on my machine.

mottosso commented 6 years ago

Since the linux part of the distribution does not have any of the required modules, like pymongo and PyQt5, you end up having to install everything for tests.

It should, we just haven't added it yet. Like how it contains the Windows dependencies, we'll need to add ones for Linux.

But for now I think it's safer to run CI on Windows instead, via AppVeyor.

tokejepsen commented 6 years ago

Are you able to run docker commands in cmd.exe?

mottosso commented 6 years ago

Let's see. No, for Toolbox I think you need to use MSYS2, like the Quickstart executable they ship with.

So for running tests on CI, you can either pick Linux or Windows.

With that in mind, I'd stick with Linux, install pymongo during the test and use it to perform the test. I wouldn't worry about not having PyQt5, we don't need to test the GUI here we can do that in core where Docker isn't involved.