Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1428: unit-tests not working in docker env #1429

Merged
merged 2 commits into from
Jul 31, 2019

Conversation

ptrovatelli
Copy link
Contributor

The fix includes:

  • add docker/entrypoint-unit-tests-devDocker.sh entrypoint file in Dockerfile.django (merge error from python2 branch I guess)
  • replace hello-world image by busybox with fixed version
    • for some reason the hello-world image wasn't working anymore with [] entrypoint. Maybe due to a change in the docker image itself. while looking for a solution i've found this busybox image which is also much smaller.
    • I have fixed the image version for more stability

The last issue remaining is those multiple occurences of errors

celeryworker_1  | [2019-07-29 08:29:50,725: ERROR/MainProcess] Task dojo.tasks.async_dupe_delete[0ac89d26-4462-4440-81e1-ce0b6aac82b7] raised unexpected: DoesNotExist('System_Settings matching query does not exist.')

although it's not preventing the tests from running:

uwsgi_1         | Ran 242 tests in 55.058s
uwsgi_1         |
uwsgi_1         | OK (skipped=14)

@Maffooch
Copy link
Contributor

@ptrovatelli For some reason, the uwsgi container cannot find the entrypoint-unit-tests-devDocker.sh file despite it being there in the usual place. Any tips?

@ptrovatelli
Copy link
Contributor Author

@Maffooch thanks for checking on that! I think you need may need to rebuild the images as the script is copied there while building the images

@Maffooch
Copy link
Contributor

@ptrovatelli Ill give that a try and report back. Thanks!

@ptrovatelli
Copy link
Contributor Author

ptrovatelli commented Jul 30, 2019

I have just noticed that this setup doesn't prevent the build of nginx image from Dockerfile.nginx when in unit_tests configuration so we still end up with a 200MB image based on busybox with nginx static files inside. i'm trying to see if I can override this with another dockerfile or else maybe it's better to keep the same image for nginx and just override the entrypoint.

@Maffooch i'll get back to you in a while

@ptrovatelli
Copy link
Contributor Author

@Maffooch OK all good. it's much better now. in unit_tests settings, nginx image is replaced by the busybox one which builds in seconds and takes a few MB

$docker images
REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
defectdojo/defectdojo-busybox   latest              e364e642a7c5        30 minutes ago      1.44MB
busybox                         1.31.0-musl         65a3b9e8dac8        11 days ago         1.44MB

This is because there is no way to remove something from docker-compose.yml using an override: we can only add/replace things and we don't need nginx for unit tests

Please squash commits when merging the last commit message is not ideal

@ptrovatelli ptrovatelli requested review from Maffooch and a team July 31, 2019 13:38
Copy link
Contributor

@Maffooch Maffooch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything about this makes things so much faster! Excellent work here.

@devGregA devGregA merged commit a6983f5 into DefectDojo:dev Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants