I’m trying to get automated testing to work on a trivial example, as per …
… and I must be missing something obvious. I can’t seem to get the test to even run at all, though my image is being auto-built and pushed just fine.
I have the following 3 files in my source repo and I have followed the directions on the page linked above to turn on the Autotest option for “Internal and external pull requests”.
Dockerfile:
FROM debian:stable
WORKDIR /workspace
COPY run_docker_tests.sh /usr/local/bin
Alternatively, could someone point me to a complete “Hello World”-level example of a working auto test setup, ideally with a failing test that would prevent the pushing of the auto build?
Ok, I’m starting to understand somewhat now. You are expecting the run_docker_tests.sh script to fail in your test, and it does locally when you run a container from the rdzman/test image. But when you push the rdzman/test docker image to Docker Hub the “auto build test” is not being triggered?
I just figured out why your automated test is not being triggered.
Your docker compose yml file name is incorrect.
Rename your docker-compose.test.yml file to docker-compose-test.yml and push that change up to your GitHub or Bitbucket repository. That should trigger the Automated Build and Test on your Docker Hub image repository.
OK, I tried renaming docker-compose.test.yml to docker-compose-test.yml, but it doesn’t seem to have made any difference. The test still isn’t running. I will point out that documentation on Automated repository tests page says docker-compose.test.yml, not docker-compose-test.yml. But neither appears to be working for me.
I can’t see the build logs for your HelloWorld example here (to confirm that it’s running the auto test), but I guess I’ll try follow everything exactly to see if I can get it to work on my accounts.
No, that wasn’t the issue I finally found it after taking my fork of your working helloworld repo and modifying things step-by-step until it was identical to mine and still working, while my original was still not working. At this point, I began to question my sanity.
The culprit … an invisible space at the end of my docker-compose.test.yml filename!!!
I can’t believe I didn’t think to check for something like that immediately. But thanks, Gary, for your time and the working example. I was missing the version and services lines in my docker-compose.test.yml file and having something that worked was what finally allowed me to track down the culprit.