mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix many issues with the Python tests that only seem to show up on Github runners.
This commit is contained in:
parent
b780339abb
commit
e7bea6686b
45
.github/workflows/run-python-tests.yml
vendored
45
.github/workflows/run-python-tests.yml
vendored
@ -8,6 +8,9 @@ on:
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
POSTGRESQL_VERSION: 15
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
@ -19,41 +22,37 @@ jobs:
|
||||
run: |
|
||||
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
||||
|
||||
- name: Install platform dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt upgrade -y
|
||||
sudo apt install -y build-essential python3-dev python3-pip libpq-dev libffi-dev libssl-dev libkrb5-dev zlib1g-dev postgresql-15 postgresql-15-pldebugger pgagent
|
||||
|
||||
sudo apt install -y build-essential python3-dev python3-pip libpq-dev libffi-dev libssl-dev libkrb5-dev zlib1g-dev postgresql-${POSTGRESQL_VERSION} postgresql-${POSTGRESQL_VERSION}-pldebugger pgagent
|
||||
- name: Create the tablespace directory
|
||||
run: |
|
||||
sudo mkdir -p /var/lib/postgresql/tablespaces/15
|
||||
sudo chown postgres:postgres /var/lib/postgresql/tablespaces/15
|
||||
|
||||
sudo mkdir -p /var/lib/postgresql/tablespaces/${POSTGRESQL_VERSION}
|
||||
sudo chown postgres:postgres /var/lib/postgresql/tablespaces/${POSTGRESQL_VERSION}
|
||||
- name: Start PostgreSQL
|
||||
run: |
|
||||
sudo echo -e "local all all trust\n$(sudo cat /etc/postgresql/15/main/pg_hba.conf)" > /etc/postgresql/15/main/pg_hba.conf
|
||||
sudo echo "shared_preload_libraries = '$libdir/plugin_debugger'" > /etc/postgresql/15/main/postgresql.auto.conf
|
||||
su - postgres -c '/usr/lib/postgresql/15/bin/postgres -D /var/lib/postgresql/15/main -c config_file=/etc/postgresql/15/main/postgresql.conf &'
|
||||
# Note: we use a custom port for PostgreSQL as the runner may already have a version of PostgreSQL installed
|
||||
sudo su -c "echo local all all trust > /etc/postgresql/${POSTGRESQL_VERSION}/main/pg_hba.conf"
|
||||
sudo sed -i "s/port = 543[0-9]/port = 59${POSTGRESQL_VERSION}/g" /etc/postgresql/${POSTGRESQL_VERSION}/main/postgresql.conf
|
||||
sudo sed -i "s/#shared_preload_libraries = ''/shared_preload_libraries = '\$libdir\/plugin_debugger'/g" /etc/postgresql/${POSTGRESQL_VERSION}/main/postgresql.conf
|
||||
sudo su - postgres -c "/usr/lib/postgresql/${POSTGRESQL_VERSION}/bin/postgres -D /var/lib/postgresql/${POSTGRESQL_VERSION}/main -c config_file=/etc/postgresql/${POSTGRESQL_VERSION}/main/postgresql.conf &"
|
||||
|
||||
until runuser -l postgres -c 'pg_isready' 2>/dev/null; do
|
||||
until sudo runuser -l postgres -c "pg_isready -p 59${POSTGRESQL_VERSION}" 2>/dev/null; do
|
||||
>&2 echo "Postgres is unavailable - sleeping for 2 seconds"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
psql -U postgres -c 'CREATE EXTENSION pgagent;'
|
||||
|
||||
psql -U postgres -p 59${POSTGRESQL_VERSION} -c 'CREATE EXTENSION pgagent;'
|
||||
psql -U postgres -p 59${POSTGRESQL_VERSION} -c 'CREATE EXTENSION pldbgapi;'
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
sudo pip install --upgrade pip
|
||||
sudo pip install -r web/regression/requirements.txt
|
||||
|
||||
sudo pip install "pyOpenSSL>=23.*"
|
||||
- name: Create the test configuration
|
||||
run: |
|
||||
cat <<EOF > web/config_local.py
|
||||
from config import *
|
||||
|
||||
# Debug mode
|
||||
DEBUG = True
|
||||
|
||||
@ -75,7 +74,6 @@ jobs:
|
||||
TEST_SQLITE_PATH = "$(pwd)/var/pgadmin4.db"
|
||||
AZURE_CREDENTIAL_CACHE_DIR = "$(pwd)/var/azurecredentialcache"
|
||||
EOF
|
||||
|
||||
cat <<EOF > web/regression/test_config.json
|
||||
{
|
||||
"pgAdmin4_login_credentials": {
|
||||
@ -96,18 +94,18 @@ jobs:
|
||||
"server_group": 1,
|
||||
"server_credentials": [
|
||||
{
|
||||
"name": "PostgreSQL 15",
|
||||
"comment": "PostgreSQL 15 Server",
|
||||
"name": "PostgreSQL ${POSTGRESQL_VERSION}",
|
||||
"comment": "PostgreSQL ${POSTGRESQL_VERSION} Server",
|
||||
"db_username": "postgres",
|
||||
"host": "/var/run/postgresql",
|
||||
"db_password": "postgres",
|
||||
"db_port": 5432,
|
||||
"db_port": 59${POSTGRESQL_VERSION},
|
||||
"maintenance_db": "postgres",
|
||||
"sslmode": "prefer",
|
||||
"tablespace_path": "/var/lib/postgresql/tablespaces/15",
|
||||
"tablespace_path": "/var/lib/postgresql/tablespaces/${POSTGRESQL_VERSION}",
|
||||
"enabled": true,
|
||||
"default_binary_paths": {
|
||||
"pg": "/usr/lib/postgresql/15/bin",
|
||||
"pg": "/usr/lib/postgresql/${POSTGRESQL_VERSION}/bin",
|
||||
"ppas": ""
|
||||
}
|
||||
}
|
||||
@ -119,17 +117,18 @@ jobs:
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
- name: Run the tests
|
||||
run: make check-python
|
||||
|
||||
- name: Archive server log
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: server-log
|
||||
path: var/pgadmin4.log
|
||||
|
||||
- name: Archive regression log
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: regression-log
|
||||
|
Loading…
Reference in New Issue
Block a user