Use a matrix based test for the different EPAS versions.

This adds parallelism for the different versions, and separates the logs.
pull/6097/head
Dave Page 2023-04-05 16:09:37 +01:00
parent 0987c955f5
commit b14834b06c
1 changed files with 27 additions and 54 deletions

View File

@ -17,15 +17,17 @@ on:
workflow_dispatch: workflow_dispatch:
env:
POSTGRESQL_VERSIONS: 15 14 13 12 11
jobs: jobs:
build: build:
# Only run if the tests are enabled # Only run if the tests are enabled
# TODO: Figure out a way to test for the presence of the secrets instead # TODO: Figure out a way to test for the presence of the secrets instead
if: vars.ENABLE_EPAS_TESTS == 'true' if: vars.ENABLE_EPAS_TESTS == 'true'
strategy:
fail-fast: false
matrix:
pgver: [11, 12, 13, 14, 15]
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
steps: steps:
@ -39,40 +41,29 @@ jobs:
- name: Install platform dependencies - name: Install platform dependencies
run: | run: |
PACKAGES=
for VERSION in ${POSTGRESQL_VERSIONS};
do
PACKAGES="${PACKAGES} edb-as${VERSION}-server edb-as${VERSION}-server-pldebugger edb-as${VERSION}-pgagent"
done
sudo apt update sudo apt update
sudo apt install -y libpq-dev libffi-dev libssl-dev libkrb5-dev zlib1g-dev ${PACKAGES} sudo apt install -y libpq-dev libffi-dev libssl-dev libkrb5-dev zlib1g-dev edb-as${{ matrix.pgver }}-server edb-as${{ matrix.pgver }}-server-pldebugger edb-as${{ matrix.pgver }}-pgagent
- name: Create the tablespace directory - name: Create the tablespace directory
run: | run: |
for VERSION in ${POSTGRESQL_VERSIONS}; sudo mkdir -p /var/lib/edb-as/tablespaces/${{ matrix.pgver }}
do sudo chown enterprisedb:enterprisedb /var/lib/edb-as/tablespaces/${{ matrix.pgver }}
sudo mkdir -p /var/lib/edb-as/tablespaces/${VERSION}
sudo chown enterprisedb:enterprisedb /var/lib/edb-as/tablespaces/${VERSION}
done
- name: Start PostgreSQL - name: Start PostgreSQL
run: | run: |
# Note: we use a custom port for PostgreSQL as the runner may already have a version of PostgreSQL installed # Note: we use a custom port for PostgreSQL as the runner may already have a version of PostgreSQL installed
for VERSION in ${POSTGRESQL_VERSIONS}; sudo su -c "echo local all all trust > /etc/edb-as/${{ matrix.pgver }}/main/pg_hba.conf"
do sudo sed -i "s/port = 544[0-9]/port = 58${{ matrix.pgver }}/g" /etc/edb-as/${{ matrix.pgver }}/main/postgresql.conf
sudo su -c "echo local all all trust > /etc/edb-as/${VERSION}/main/pg_hba.conf" sudo sed -i "s/shared_preload_libraries = '/shared_preload_libraries = '\$libdir\/plugin_debugger,/g" /etc/edb-as/${{ matrix.pgver }}/main/postgresql.conf
sudo sed -i "s/port = 544[0-9]/port = 58${VERSION}/g" /etc/edb-as/${VERSION}/main/postgresql.conf sudo su - enterprisedb -c "mkdir -p /var/run/edb-as/${{ matrix.pgver }}-main.epas_stat_tmp"
sudo sed -i "s/shared_preload_libraries = '/shared_preload_libraries = '\$libdir\/plugin_debugger,/g" /etc/edb-as/${VERSION}/main/postgresql.conf sudo systemctl restart edb-as@${{ matrix.pgver }}-main
sudo su - enterprisedb -c "mkdir -p /var/run/edb-as/${VERSION}-main.epas_stat_tmp"
sudo systemctl restart edb-as@${VERSION}-main
until sudo runuser -l enterprisedb -c "/usr/lib/edb-as/${VERSION}/bin/pg_isready -p 58${VERSION}" 2>/dev/null; do until sudo runuser -l enterprisedb -c "/usr/lib/edb-as/${{ matrix.pgver }}/bin/pg_isready -p 58${{ matrix.pgver }}" 2>/dev/null; do
>&2 echo "EPAS is unavailable - sleeping for 2 seconds" >&2 echo "EPAS is unavailable - sleeping for 2 seconds"
sleep 2 sleep 2
done
psql -U enterprisedb -d postgres -p 58${VERSION} -c 'CREATE EXTENSION IF NOT EXISTS pgagent;'
done done
psql -U enterprisedb -d postgres -p 58${{ matrix.pgver }} -c 'CREATE EXTENSION IF NOT EXISTS pgagent;'
- name: Install Python dependencies - name: Install Python dependencies
run: make install-python-testing run: make install-python-testing
@ -123,41 +114,22 @@ jobs:
}, },
"server_group": 1, "server_group": 1,
"server_credentials": [ "server_credentials": [
EOF
function add_server_def() {
SEP=","
if [ "$1" = "$2" ]; then
SEP=""
fi
cat <<EOF >> web/regression/test_config.json
{ {
"name": "EPAS $1", "name": "EPAS ${{ matrix.pgver }}",
"comment": "EPAS $1 Server", "comment": "EPAS ${{ matrix.pgver }} Server",
"db_username": "enterprisedb", "db_username": "enterprisedb",
"host": "/var/run/edb-as", "host": "/var/run/edb-as",
"db_password": "", "db_password": "",
"db_port": 58$1, "db_port": 58${{ matrix.pgver }},
"maintenance_db": "postgres", "maintenance_db": "postgres",
"sslmode": "prefer", "sslmode": "prefer",
"tablespace_path": "/var/lib/edb-as/tablespaces/$1", "tablespace_path": "/var/lib/edb-as/tablespaces/${{ matrix.pgver }}",
"enabled": true, "enabled": true,
"default_binary_paths": { "default_binary_paths": {
"pg": "", "pg": "",
"ppas": "/usr/lib/edb-as/$1/bin" "ppas": "/usr/lib/edb-as/${{ matrix.pgver }}/bin"
} }
}${SEP} }
EOF
}
LAST_VERSION=$(echo ${POSTGRESQL_VERSIONS} | awk '{print $NF}')
for VERSION in ${POSTGRESQL_VERSIONS};
do
add_server_def ${VERSION} ${LAST_VERSION}
done
cat <<EOF >> web/regression/test_config.json
], ],
"server_update_data": [ "server_update_data": [
{ {
@ -166,6 +138,7 @@ jobs:
] ]
} }
EOF EOF
- name: Run the tests - name: Run the tests
run: | run: |
. venv/bin/activate . venv/bin/activate
@ -175,12 +148,12 @@ jobs:
if: success() || failure() if: success() || failure()
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: server-log name: server-log-pg${{ matrix.pgver }}
path: var/pgadmin4.log path: var/pgadmin4.log
- name: Archive regression log - name: Archive regression log
if: success() || failure() if: success() || failure()
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: regression-log name: regression-log-pg${{ matrix.pgver }}
path: web/regression/regression.log path: web/regression/regression.log