From bd66b01b8ace66bfef8dfebfe97a841419949481 Mon Sep 17 00:00:00 2001 From: Rae Knowler Date: Thu, 14 Nov 2024 14:10:40 +0100 Subject: [PATCH] tests: Change test container user to root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See this comment by AdriĆ  for details: https://github.com/ckan/ckan-docker-base/issues/86#issuecomment-2476152448. --- .github/workflows/test.yml | 4 ++-- bin/install_test_requirements.sh | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fe418e48..14a7de4e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -61,7 +61,7 @@ jobs: - name: Create ckan container run: | /usr/bin/docker create --name test_ckan --network ${{ job.container.network }} --network-alias ckan \ - --env-file ${{ github.workspace }}/github-workflow.env \ + --env-file ${{ github.workspace }}/github-workflow.env --user root \ -v "/var/run/docker.sock":"/var/run/docker.sock" \ -v "/home/runner/work":"/__w" -v "/home/runner/work/_temp":"/__w/_temp" \ -v "/home/runner/work/_actions":"/__w/_actions" -v "/opt/hostedtoolcache":"/__t" \ @@ -71,7 +71,7 @@ jobs: docker start test_ckan - name: Install requirements and set up ckanext run: | - docker exec -u root test_ckan $WORKDIR/bin/install_test_requirements.sh + docker exec test_ckan $WORKDIR/bin/install_test_requirements.sh - name: Run tests run: | docker exec test_ckan pytest --ckan-ini=$WORKDIR/test.ini --disable-warnings --cov=ckanext.switzerland \ diff --git a/bin/install_test_requirements.sh b/bin/install_test_requirements.sh index bdfeb89c..f36fb732 100755 --- a/bin/install_test_requirements.sh +++ b/bin/install_test_requirements.sh @@ -17,6 +17,3 @@ pip install -r https://raw.githubusercontent.com/ckan/ckanext-fluent/master/requ # Init db and re-enable required plugins ckan -c /__w/ckanext-switzerland/ckanext-switzerland/test.ini db init ckan -c /__w/ckanext-switzerland/ckanext-switzerland/test.ini db pending-migrations --apply - -# Make ckan user owner of this directory so it can save the pytest-coverage file -chown ckan:ckan-sys /srv/app