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

tests: don't run commands in the server container as root #6717

Merged
merged 1 commit into from
Aug 22, 2023

Conversation

SpecLad
Copy link
Contributor

@SpecLad SpecLad commented Aug 21, 2023

Motivation and context

I encountered an issue where the server process fails at startup due to being unable to create /home/django/cache/events, due to /home/django/cache being owned by root.

I'm not sure how exactly that happened, but there are several commands involving Django or CVAT data that the test suite runs as root, and it had to be one of them that caused it.

I don't think there's any reason to run these commands as root, so use docker_exec_cvat for them instead of docker_exec. This way, they will run as the Django user instead.

How has this been tested?

Unit tests.

Checklist

  • I submit my changes into the develop branch
  • [ ] I have added a description of my changes into the CHANGELOG file
  • [ ] I have updated the documentation accordingly
  • [ ] I have added tests to cover my changes
  • [ ] I have linked related issues (see GitHub docs)
  • [ ] I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

I encountered an issue where the server process fails at startup due to
being unable to create `/home/django/cache/events`, due to
`/home/django/cache` being owned by `root`.

I'm not sure how exactly that happened, but there are several commands
involving Django or CVAT data that the test suite runs as root, and it had
to be one of them that caused it.

I don't think there's any reason to run these commands as root, so use
`docker_exec_cvat` for them instead of `docker_exec`. This way, they will
run as the Django user instead.
@codecov
Copy link

codecov bot commented Aug 21, 2023

Codecov Report

Merging #6717 (94e04ba) into develop (afefe22) will decrease coverage by 0.01%.
Report is 1 commits behind head on develop.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           develop    #6717      +/-   ##
===========================================
- Coverage    82.26%   82.26%   -0.01%     
===========================================
  Files          366      366              
  Lines        39771    39771              
  Branches      3531     3531              
===========================================
- Hits         32718    32716       -2     
- Misses        7053     7055       +2     
Components Coverage Δ
cvat-ui 77.03% <ø> (ø)
cvat-server 86.81% <ø> (-0.01%) ⬇️

@SpecLad SpecLad merged commit 59ae3e5 into cvat-ai:develop Aug 22, 2023
36 checks passed
@SpecLad SpecLad deleted the no-root-for-django branch August 22, 2023 09:16
jonybekov pushed a commit to tezzro/cvat that referenced this pull request Sep 6, 2023
I encountered an issue where the server process fails at startup due to
being unable to create `/home/django/cache/events`, due to
`/home/django/cache` being owned by `root`.

I'm not sure how exactly that happened, but there are several commands
involving Django or CVAT data that the test suite runs as root, and it
had to be one of them that caused it.

I don't think there's any reason to run these commands as root, so use
`docker_exec_cvat` for them instead of `docker_exec`. This way, they
will run as the Django user instead.
mikhail-treskin pushed a commit to retailnext/cvat that referenced this pull request Oct 25, 2023
I encountered an issue where the server process fails at startup due to
being unable to create `/home/django/cache/events`, due to
`/home/django/cache` being owned by `root`.

I'm not sure how exactly that happened, but there are several commands
involving Django or CVAT data that the test suite runs as root, and it
had to be one of them that caused it.

I don't think there's any reason to run these commands as root, so use
`docker_exec_cvat` for them instead of `docker_exec`. This way, they
will run as the Django user instead.
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.

2 participants