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

commented Jul 29, 2019

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

This comment has been minimized.

Copy link
Contributor

commented Jul 29, 2019

@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

This comment has been minimized.

Copy link
Contributor Author

commented Jul 29, 2019

@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

This comment has been minimized.

Copy link
Contributor

commented Jul 29, 2019

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

@ptrovatelli

This comment has been minimized.

Copy link
Contributor Author

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

TROVATELLI Pascal
@ptrovatelli

This comment has been minimized.

Copy link
Contributor Author

commented Jul 30, 2019

@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 DefectDojo/defectdojo-moderators Jul 31, 2019
Copy link
Contributor

left a comment

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

@devGregA devGregA merged commit a6983f5 into DefectDojo:dev Jul 31, 2019
4 checks passed
4 checks passed
AccessLint Review complete
continuous-integration/travis-ci/pr The Travis CI build passed
Details
security/snyk - components/package.json (aaronweaver (GitHub marketplace)) No manifest changes detected
security/snyk - requirements.txt (aaronweaver (GitHub marketplace)) No manifest changes detected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.