From 2bd9afdb0e3821b1b908d06ef1b14b90a7f8f8fd Mon Sep 17 00:00:00 2001 From: Martin Styk Date: Sat, 23 Dec 2023 14:04:45 +0100 Subject: [PATCH] Run integration tests as part of review checks Signed-off-by: Martin Styk --- .github/workflows/review-checks.yml | 66 +++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/.github/workflows/review-checks.yml b/.github/workflows/review-checks.yml index 26931af72..9afcc228f 100644 --- a/.github/workflows/review-checks.yml +++ b/.github/workflows/review-checks.yml @@ -43,3 +43,69 @@ jobs: name: beaker-docs path: /home/runner/work/html + integration-tests: + runs-on: ubuntu-latest + env: + MYSQL_USER: beaker + MYSQL_PASSWORD: beaker + MYSQL_ROOT_PASSWORD: toor + strategy: + fail-fast: false + matrix: + test-target: ["bkr.inttest.client"] + container: + image: centos:7 + services: + database: + image: mariadb:latest + env: + MYSQL_USER: ${{ env.MYSQL_USER }} + MYSQL_PASSWORD: ${{ env.MYSQL_PASSWORD }} + MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }} + ports: + - 3306 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Add Beaker Server YUM repository + run: | + curl -o /etc/yum.repos.d/beaker-server.repo https://beaker-project.org/yum/beaker-server-RedHatEnterpriseLinux.repo + + - name: Install Beaker dependencies + run: | + pwd + ls -la + yum install epel-release mariadb beaker-integration-tests -y + yum-builddep beaker.spec -y + yum remove beaker-common \ + beaker-client \ + beaker-lab-controller \ + beaker-server \ + beaker-integration-tests -y + + - name: Checkout submodules + run: | + pwd + ls -la + git submodule update --init --recursive + + - name: Configure database for testing + run: | + set -x + + cat < init.sql + CREATE DATABASE beaker_test; + CREATE DATABASE beaker_migration_test; + GRANT ALL PRIVILEGES ON beaker_test.* TO 'beaker'@'%'; + GRANT ALL PRIVILEGES ON beaker_migration_test.* TO 'beaker'@'%'; + EOT + + mysql -uroot -p${{ env.MYSQL_ROOT_PASSWORD }} -h database < init.sql + sed -i 's/@localhost/@database/g' IntegrationTests/server-test.cfg + cat IntegrationTests/server-test.cfg + + - name: Run integration tests for ${{ matrix.test-target }} + run: | + pushd IntegrationTests + ./run-tests.sh ${{ matrix.test-target }}