JiscSD / archivematica-storage-service

Archivematica storage service
http://www.archivematica.org
GNU Affero General Public License v3.0
0 stars 0 forks source link

Problem: running test suite is not easy enough #9

Open sevein opened 7 years ago

sevein commented 7 years ago

Once #7 is merged and you've built the Docker image (docker build -t ss .) you can run the test suite with:

$ docker run --rm --entrypoint pytest \
    --env "DJANGO_SETTINGS_MODULE=storage_service.settings.test" \
    --env "SS_DB_NAME=_" \
    --env "SS_DB_USER=_" \
    --env "SS_DB_PASSWORD=_" \
    --env "SS_DB_HOST=_" \
    --env "DJANGO_SECRET_KEY=_" \
    --env "DJANGO_ALLOWED_HOSTS=_" \
    --user "root" ss

But I think we should relax the requirements of storage_service.settings.test so we can just do:

$ docker run --rm --entrypoint pytest ss

It also should not require root, which is an easy fix. The problem is that pytest is trying to create the .cache folder in the source directory which is not owned by archivematica.

lower29 commented 7 years ago

I've been staring at the second docker command for ages but I still can't see a difference. Did you paste the wrong thing? The two commands look identical!

sevein commented 7 years ago

Hahaha! Sorry, I totally forgot to update it! Done now, thanks!

sevein commented 7 years ago

Related: https://github.com/artefactual/archivematica-storage-service/issues/220.

sevein commented 6 years ago

Something like the following should work now and --user=root shouldn't be needed anymore after #25 being merged. This could be added to the Makefile in our Compose environment.

test-storage-service:
    docker-compose run \
        --workdir /src \
        --rm --no-deps \
        --entrypoint py.test \
        -e "DJANGO_SETTINGS_MODULE=storage_service.settings.test" \
                archivematica-storage-service

Preferably we should use tox as the entrypoint, that's something we should try. If you do that, you don't need to worry about setting DJANGO_SETTINGS_MODULE. It'd also be nice if we could pass arguments to tox. E.g. as a developer I always do things like this: tox -e py36 -- -x where -x is passed down to py.test.