Testing deviceauth from tests folder

Hi,
I have gone through the blog, https://mender.io/blog/mender-pays-close-attention-to-quality-assurance .
I took the deviceauth repo and went inside the tests folder.
There is a readme but the scripts mentioned in that readme are not existing.
When I run the command docker-compose up, I got below error:


[mender]$ docker-compose -f docker-compose-acceptance.yml up
Starting tests_mender-device-auth_1 … done
Starting tests_acceptance_1 … done
Attaching to tests_mender-device-auth_1, tests_acceptance_1
acceptance_1 | bash: /testing/run.sh: No such file or directory
tests_acceptance_1 exited with code 127
mender-device-auth_1 | failed to connect to db: failed to verify mongodb connection: context deadline exceeded

What am I missing here?
_
Pei

1 Like

Hi @pei.cei,

I am really happy that you are trying it out yourself :slight_smile: Thanks for your interest.

It is not very well documented, I am afraid. Following our microservices architecture, the bits and pieces to do testing are also scattered around several repositories…

For all our backend repositories, the CI uses this GitLab template to build and run acceptance tests. Inspecting a bit the scripts there, you could figure out how to build the tester, download external dependencies, and launch the tests. But here comes a recipe that you could user for deviceauth:

# Build the tester
docker build -f Dockerfile.acceptance-testing -t mendersoftware/deviceauth:prtest .
# Get wrapper
git clone --depth=1 https://github.com/mendersoftware/integration.git mender-integration
cp mender-integration/extra/travis-testing/* tests/
# Copy swagger specs
cp docs/* tests/
# Build and copy the binary
go build
cp deviceauth /tests
# Get and copy mender-artifact
wget https://downloads.mender.io/mender-artifact/master/linux/mender-artifact
chmod +x mender-artifact
cp mender-artifact tests/
# Run tests!
TESTS_DIR=$(pwd)/tests $(pwd)/tests/run-test-environment acceptance $(pwd)/mender-integration $(pwd)/tests/docker-compose-acceptance.yml

I hope this is helpful to you.

Your question made me realize that we should update these README files in all repos (maybe just pointing to a centralized one in a testing repo) to help community run the acceptance tests locally. I take note :wink:

Lluís

Thank you @lluiscampos for the answer. Actually, I am interested to run all the tests shown in the pic from the blog from unit testing to acceptance test for all the repositories. I am open to document it for the community. if you can point me to the scripts to run the tests at each level, it will be great.

Thanks,
Pei

@pei.cei to run all tests locally will be quite tricky (and costly! For example client acceptance tests take ~12h computer power with 16 CPUs machines), but I will be happy to give you more insight into it. I don’t have the time just today, but I promise I’ll go back to you soon.

1 Like

Hi @pei.cei and thanks for your patience.

I wrote a document with the overview of our test suites and where to find most of the bits and pieces necessary to run the tests. You can find the first draft here (being reviewed by all my fellow colleagues here).

I’ll be glad to answer further questions.

Most of the test suites are open source (including the ones that test Enterprise components), so you should be able to navigate them with no big inconvenient.

Lluís