diff --git a/.circleci/config.yml b/.circleci/config.yml index 9df059d7..a495dacc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,24 +25,9 @@ jobs: - checkout - run: make test_python_style - - integration: - machine: - image: ubuntu-2004:202201-02 - steps: - - checkout - - run: - command: | - pyenv versions - pyenv global 3.10.2 - docker pull registry.opensuse.org/devel/openqa/ci/containers/serviced - sudo chown -R 1000:1000 . - make test_docker PRIVILEGED_TESTS=1 - workflows: version: 2.1 test: jobs: - unit - - integration - style diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml new file mode 100644 index 00000000..174e5d79 --- /dev/null +++ b/.github/workflows/integration.yaml @@ -0,0 +1,17 @@ +--- +name: CI + +on: [pull_request, workflow_dispatch] # yamllint disable-line rule:truthy + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: integration + run: | + pyenv versions + pyenv global 3.10.2 + podman pull registry.opensuse.org/devel/openqa/ci/containers/serviced + sudo chown -R 1000:1000 . + make test_docker PRIVILEGED_TESTS=1 diff --git a/t/docker/lib/common.sh b/t/podman/lib/common.sh similarity index 94% rename from t/docker/lib/common.sh rename to t/podman/lib/common.sh index a6872347..55d3112d 100644 --- a/t/docker/lib/common.sh +++ b/t/podman/lib/common.sh @@ -5,16 +5,23 @@ prepare_project() { prj=$1 suff=$2 -su $dbuser -c "set -ex +( cd /opt/openqa-trigger-from-obs mkdir -p $prj +chown $dbuser $prj +echo geekotest > rsync.secret +chmod 600 rsync.secret +chown $dbuser rsync.secret +) + +su $dbuser -c "set -ex +cd /opt/openqa-trigger-from-obs python3 script/scriptgen.py $prj for l in $prj/*/.run_last ; do [ ! -e \$l ] || rm \$l done [ ! -e $prj/.run_last ] || rm $prj/.run_last -echo geekotest > rsync.secret -chmod 600 rsync.secret" +" echo "[production] dsn = DBI:Pg:dbname=openqa;host=/tmp" > /usr/share/openqa/etc/openqa/database.ini @@ -28,6 +35,7 @@ chmod +x /var/lib/openqa/osc-plugin-factory/factory-package-news/factory-package systemctl start postgresql +systemctl restart apache2 systemctl restart openqa-webui.service systemctl restart openqa-websockets.service systemctl restart rsyncd diff --git a/t/docker/lib/test-in-container-systemd.sh b/t/podman/lib/test-in-container-systemd.sh similarity index 69% rename from t/docker/lib/test-in-container-systemd.sh rename to t/podman/lib/test-in-container-systemd.sh index 798c4ca4..5afb1e92 100755 --- a/t/docker/lib/test-in-container-systemd.sh +++ b/t/podman/lib/test-in-container-systemd.sh @@ -29,11 +29,11 @@ containername="localtest.${basename,,}" test "${PRIVILEGED_TESTS}" == 1 || ( echo PRIVILEGED_TESTS is not set to 1 ; exit 1) -docker info >/dev/null 2>&1 || (echo Docker doesnt seem to be running ; exit 1) +podman info >/dev/null 2>&1 || (echo podman doesnt seem to be running ; exit 1) map_port="" [ -z "$EXPOSE_PORT" ] || map_port="-p $EXPOSE_PORT:80" -docker run --privileged $map_port -v"$thisdir/../../..":/opt/openqa-trigger-from-obs --env METHOD=$METHOD --rm --name "$containername" -d -v /sys/fs/cgroup:/sys/fs/cgroup:ro -- registry.opensuse.org/devel/openqa/ci/containers/serviced +podman run --privileged $map_port -v"$thisdir/../../..":/opt/openqa-trigger-from-obs:z --env METHOD=$METHOD --rm --name "$containername" -d -- registry.opensuse.org/devel/openqa/ci/containers/serviced in_cleanup=0 @@ -44,7 +44,7 @@ function cleanup { read -rsn1 -p"Test failed, press any key to finish";echo fi [ "$ret" == 0 ] || echo FAIL $basename - docker stop -t 0 "$containername" >&/dev/null || : + podman stop -t 0 "$containername" >&/dev/null || : } trap cleanup INT TERM EXIT @@ -53,17 +53,17 @@ counter=1 # wait container start until [ $counter -gt 10 ]; do sleep 0.5 - docker exec "$containername" pwd >& /dev/null && break + podman exec "$containername" pwd >& /dev/null && break ((counter++)) done -docker exec "$containername" pwd >& /dev/null || (echo Cannot start container; exit 1 ) >&2 +podman exec "$containername" pwd >& /dev/null || (echo Cannot start container; exit 1 ) >&2 -docker exec "$containername" bash /opt/init-trigger-from-obs.sh +podman exec "$containername" bash /opt/init-trigger-from-obs.sh -[ -z "$CIRCLE_JOB" ] || echo 'aa-complain /usr/share/openqa/script/openqa' | docker exec "$containername" bash -x +[ -z "$CIRCLE_JOB" ] || echo 'aa-complain /usr/share/openqa/script/openqa' | podman exec "$containername" bash -x set +e -docker cp lib/common.sh "$containername":/lib -docker exec -e TESTCASE="$testcase" "$containername" bash -xe /opt/openqa-trigger-from-obs/t/docker/$testcase +podman cp lib/common.sh "$containername":/lib +podman exec -e TESTCASE="$testcase" "$containername" bash -xe /opt/openqa-trigger-from-obs/t/podman/$testcase ret=$? ( exit $ret ) diff --git a/t/docker/rest.sh b/t/podman/rest.sh similarity index 100% rename from t/docker/rest.sh rename to t/podman/rest.sh diff --git a/t/docker/rsync.sh b/t/podman/rsync.sh similarity index 100% rename from t/docker/rsync.sh rename to t/podman/rsync.sh diff --git a/t/docker/script/openSUSE:Factory:ToTest.sh b/t/podman/script/openSUSE:Factory:ToTest.sh similarity index 100% rename from t/docker/script/openSUSE:Factory:ToTest.sh rename to t/podman/script/openSUSE:Factory:ToTest.sh diff --git a/t/docker/script/openSUSE:Leap:15.2:ARM:ToTest.sh b/t/podman/script/openSUSE:Leap:15.2:ARM:ToTest.sh similarity index 100% rename from t/docker/script/openSUSE:Leap:15.2:ARM:ToTest.sh rename to t/podman/script/openSUSE:Leap:15.2:ARM:ToTest.sh diff --git a/t/docker/script/openSUSE:Leap:15.2:Staging:A.sh b/t/podman/script/openSUSE:Leap:15.2:Staging:A.sh similarity index 100% rename from t/docker/script/openSUSE:Leap:15.2:Staging:A.sh rename to t/podman/script/openSUSE:Leap:15.2:Staging:A.sh diff --git a/t/docker/script/openSUSE:Leap:15.4:WSL.sh b/t/podman/script/openSUSE:Leap:15.4:WSL.sh similarity index 100% rename from t/docker/script/openSUSE:Leap:15.4:WSL.sh rename to t/podman/script/openSUSE:Leap:15.4:WSL.sh diff --git a/t/run_docker.sh b/t/run_docker.sh index 5335e7ba..bbd25282 100644 --- a/t/run_docker.sh +++ b/t/run_docker.sh @@ -2,7 +2,7 @@ cd "$(dirname "${BASH_SOURCE[0]}")" ( dockerfail=0 -cd docker +cd podman for t in *.sh; do [ -x "$t" ] || continue for i in $(seq 1 3); do