未验证 提交 59ae3e54 编写于 作者: R Roman Donchenko 提交者: GitHub

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

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.
上级 3e470647
......@@ -279,7 +279,7 @@ def docker_restore_data_volumes():
CVAT_DB_DIR / "cvat_data.tar.bz2",
f"{PREFIX}_cvat_server_1:/tmp/cvat_data.tar.bz2",
)
docker_exec(Container.SERVER, "tar --strip 3 -xjf /tmp/cvat_data.tar.bz2 -C /home/django/data/")
docker_exec_cvat("tar --strip 3 -xjf /tmp/cvat_data.tar.bz2 -C /home/django/data/")
def kube_restore_data_volumes():
......@@ -403,7 +403,7 @@ def local_start(start, stop, dumpdb, cleanup, rebuild, cvat_root_dir, cvat_db_di
docker_cp(cvat_db_dir / "data.json", f"{PREFIX}_cvat_server_1:/tmp/data.json")
wait_for_services()
docker_exec(Container.SERVER, "python manage.py loaddata /tmp/data.json")
docker_exec_cvat("python manage.py loaddata /tmp/data.json")
docker_exec(
Container.DB, "psql -U root -d postgres -v from=cvat -v to=test_db -f /tmp/restore.sql"
)
......@@ -455,7 +455,7 @@ def session_finish(session):
docker_exec(Container.DB, "dropdb --if-exists cvat")
docker_exec(Container.DB, "createdb cvat")
docker_exec(Container.SERVER, "python manage.py migrate")
docker_exec_cvat("python manage.py migrate")
def collect_code_coverage_from_containers():
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册