mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Run feature tests on Github.
Initial patch by me, with additional testing/debugging/fixing by Yogesh Mahajan.
This commit is contained in:
parent
75d14565e4
commit
be1bdbcd14
176
.github/workflows/run-feature-tests-epas.yml
vendored
Normal file
176
.github/workflows/run-feature-tests-epas.yml
vendored
Normal file
@ -0,0 +1,176 @@
|
||||
name: Run feature tests on PostgreSQL
|
||||
|
||||
# Note: we use a custom port for PostgreSQL as the runners may already have
|
||||
# a version installed.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# Only run if the tests are enabled
|
||||
# TODO: Figure out a way to test for the presence of the secrets instead
|
||||
if: vars.ENABLE_EPAS_TESTS == 'true'
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
pgver: [11, 12, 13, 14, 15]
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup the EDB APT repo on Linux
|
||||
run: |
|
||||
sudo su -c 'echo "deb [arch=amd64] https://apt.enterprisedb.com/$(lsb_release -cs)-edb/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/edb-$(lsb_release -cs).list'
|
||||
sudo su -c 'echo "machine apt.enterprisedb.com login ${{ secrets.EDB_REPO_USERNAME }} password ${{ secrets.EDB_REPO_PASSWORD }}" > /etc/apt/auth.conf.d/edb.conf'
|
||||
sudo wget -q -O - https://apt.enterprisedb.com/edb-deb.gpg.key | sudo apt-key add -
|
||||
|
||||
- name: Install platform dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
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
|
||||
run: |
|
||||
sudo mkdir -p /var/lib/edb-as/tablespaces/${{ matrix.pgver }}
|
||||
sudo chown enterprisedb:enterprisedb /var/lib/edb-as/tablespaces/${{ matrix.pgver }}
|
||||
|
||||
- name: Start EDB PostgreSQL
|
||||
run: |
|
||||
# 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/edb-as/${{ matrix.pgver }}/main/pg_hba.conf"
|
||||
sudo sed -i "s/port = 544[0-9]/port = 58${{ matrix.pgver }}/g" /etc/edb-as/${{ matrix.pgver }}/main/postgresql.conf
|
||||
sudo sed -i "s/shared_preload_libraries = '/shared_preload_libraries = '\$libdir\/plugin_debugger,/g" /etc/edb-as/${{ matrix.pgver }}/main/postgresql.conf
|
||||
sudo su - enterprisedb -c "mkdir -p /var/run/edb-as/${{ matrix.pgver }}-main.epas_stat_tmp"
|
||||
sudo systemctl restart edb-as@${{ matrix.pgver }}-main
|
||||
|
||||
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"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
psql -U enterprisedb -d postgres -p 58${{ matrix.pgver }} -c 'CREATE EXTENSION IF NOT EXISTS pgagent;'
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: make install-python-testing
|
||||
|
||||
- name: Create the test configuration
|
||||
run: |
|
||||
cat <<EOF > web/config_local.py
|
||||
from config import *
|
||||
|
||||
# Debug mode
|
||||
DEBUG = True
|
||||
|
||||
# App mode
|
||||
SERVER_MODE = False
|
||||
|
||||
# Log
|
||||
CONSOLE_LOG_LEVEL = DEBUG
|
||||
FILE_LOG_LEVEL = DEBUG
|
||||
|
||||
DEFAULT_SERVER = '127.0.0.1'
|
||||
|
||||
UPGRADE_CHECK_ENABLED = False
|
||||
|
||||
LOG_FILE = "$(pwd)/var/pgadmin4.log"
|
||||
SESSION_DB_PATH = "$(pwd)/var/sessions"
|
||||
STORAGE_DIR = "$(pwd)/var/storage"
|
||||
SQLITE_PATH = "$(pwd)/var/pgadmin4.db"
|
||||
TEST_SQLITE_PATH = "$(pwd)/var/pgadmin4.db"
|
||||
AZURE_CREDENTIAL_CACHE_DIR = "$(pwd)/var/azurecredentialcache"
|
||||
EOF
|
||||
|
||||
cat <<EOF > web/regression/test_config.json
|
||||
{
|
||||
"headless_chrome": false,
|
||||
"default_browser": "Chrome",
|
||||
"pgAdmin4_login_credentials": {
|
||||
"new_password": "NEWPASSWORD",
|
||||
"login_password": "PASSWORD",
|
||||
"login_username": "USER@EXAMPLE.COM"
|
||||
},
|
||||
"pgAdmin4_test_user_credentials": {
|
||||
"new_password": "NEWPASSWORD",
|
||||
"login_password": "PASSWORD",
|
||||
"login_username": "USER2@EXAMPLE.COM"
|
||||
},
|
||||
"pgAdmin4_test_non_admin_credentials": {
|
||||
"new_password": "NEWPASSWORD",
|
||||
"login_password": "PASSWORD",
|
||||
"login_username": "USER@EXAMPLE.COM"
|
||||
},
|
||||
"server_group": 1,
|
||||
"server_credentials": [
|
||||
{
|
||||
"name": "EPAS ${{ matrix.pgver }}",
|
||||
"comment": "EPAS ${{ matrix.pgver }} Server",
|
||||
"db_username": "enterprisedb",
|
||||
"host": "/var/run/edb-as",
|
||||
"db_password": "",
|
||||
"db_port": 58${{ matrix.pgver }},
|
||||
"maintenance_db": "postgres",
|
||||
"sslmode": "prefer",
|
||||
"tablespace_path": "/var/lib/edb-as/tablespaces/${{ matrix.pgver }}",
|
||||
"enabled": true,
|
||||
"default_binary_paths": {
|
||||
"pg": "/usr/lib/edb-as/${{ matrix.pgver }}/bin",
|
||||
"ppas": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"server_update_data": [
|
||||
{
|
||||
"comment": "This is test update comment"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
- name: Build the JS bundle
|
||||
run: |
|
||||
cd web
|
||||
yarn install
|
||||
yarn run bundle
|
||||
|
||||
- name: Run the tests
|
||||
run: |
|
||||
. venv/bin/activate
|
||||
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
|
||||
export DISPLAY=:99
|
||||
cd web
|
||||
python regression/runtests.py --pkg feature_tests
|
||||
|
||||
- name: Archive server log
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: server-log-pg${{ matrix.pgver }}
|
||||
path: var/pgadmin4.log
|
||||
|
||||
- name: Archive regression log
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: regression-log-pg${{ matrix.pgver }}
|
||||
path: web/regression/regression.log
|
||||
|
||||
- name: Archive screenshots
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: screenshots-pg${{ matrix.pgver }}
|
||||
path: web/regression/screenshots
|
||||
if-no-files-found: ignore
|
176
.github/workflows/run-feature-tests-pg.yml
vendored
Normal file
176
.github/workflows/run-feature-tests-pg.yml
vendored
Normal file
@ -0,0 +1,176 @@
|
||||
name: Run feature tests on PostgreSQL
|
||||
|
||||
# Note: we use a custom port for PostgreSQL as the runners may already have
|
||||
# a version installed.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
pgver: [11, 12, 13, 14, 15]
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup the PGDG APT repo
|
||||
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 install -y libpq-dev libffi-dev libssl-dev libkrb5-dev zlib1g-dev postgresql-${{ matrix.pgver }} postgresql-${{ matrix.pgver }}-pldebugger pgagent
|
||||
|
||||
- name: Create the tablespace directory
|
||||
run: |
|
||||
sudo mkdir -p /var/lib/postgresql/tablespaces/${{ matrix.pgver }}
|
||||
sudo chown postgres:postgres /var/lib/postgresql/tablespaces/${{ matrix.pgver }}
|
||||
|
||||
- name: Re-create stats directory, just in case
|
||||
run: |
|
||||
sudo rm -rf /var/run/postgresql/${{ matrix.pgver }}-main.pg_stat_tmp/
|
||||
sudo mkdir -p /var/run/postgresql/${{ matrix.pgver }}-main.pg_stat_tmp/
|
||||
sudo chown postgres:postgres /var/run/postgresql/${{ matrix.pgver }}-main.pg_stat_tmp/
|
||||
|
||||
- name: Start PostgreSQL
|
||||
run: |
|
||||
sudo su -c "echo local all all trust > /etc/postgresql/${{ matrix.pgver }}/main/pg_hba.conf"
|
||||
sudo sed -i "s/port = 543[0-9]/port = 59${{ matrix.pgver }}/g" /etc/postgresql/${{ matrix.pgver }}/main/postgresql.conf
|
||||
sudo sed -i "s/#shared_preload_libraries = ''/shared_preload_libraries = '\$libdir\/plugin_debugger'/g" /etc/postgresql/${{ matrix.pgver }}/main/postgresql.conf
|
||||
sudo su - postgres -c "/usr/lib/postgresql/${{ matrix.pgver }}/bin/postgres -D /var/lib/postgresql/${{ matrix.pgver }}/main -c config_file=/etc/postgresql/${{ matrix.pgver }}/main/postgresql.conf &"
|
||||
|
||||
until sudo runuser -l postgres -c "pg_isready -p 59${{ matrix.pgver }}" 2>/dev/null; do
|
||||
>&2 echo "Postgres is unavailable - sleeping for 2 seconds"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
psql -U postgres -p 59${{ matrix.pgver }} -c 'CREATE EXTENSION pgagent;'
|
||||
psql -U postgres -p 59${{ matrix.pgver }} -c 'CREATE EXTENSION pldbgapi;'
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: make install-python-testing
|
||||
|
||||
- name: Create the test configuration
|
||||
run: |
|
||||
cat <<EOF > web/config_local.py
|
||||
from config import *
|
||||
|
||||
# Debug mode
|
||||
DEBUG = True
|
||||
|
||||
# App mode
|
||||
SERVER_MODE = False
|
||||
|
||||
# Log
|
||||
CONSOLE_LOG_LEVEL = DEBUG
|
||||
FILE_LOG_LEVEL = DEBUG
|
||||
|
||||
DEFAULT_SERVER = '127.0.0.1'
|
||||
|
||||
UPGRADE_CHECK_ENABLED = False
|
||||
|
||||
LOG_FILE = "$(pwd)/var/pgadmin4.log"
|
||||
SESSION_DB_PATH = "$(pwd)/var/sessions"
|
||||
STORAGE_DIR = "$(pwd)/var/storage"
|
||||
SQLITE_PATH = "$(pwd)/var/pgadmin4.db"
|
||||
TEST_SQLITE_PATH = "$(pwd)/var/pgadmin4.db"
|
||||
AZURE_CREDENTIAL_CACHE_DIR = "$(pwd)/var/azurecredentialcache"
|
||||
EOF
|
||||
|
||||
cat <<EOF > web/regression/test_config.json
|
||||
{
|
||||
"headless_chrome": false,
|
||||
"default_browser": "Chrome",
|
||||
"pgAdmin4_login_credentials": {
|
||||
"new_password": "NEWPASSWORD",
|
||||
"login_password": "PASSWORD",
|
||||
"login_username": "USER@EXAMPLE.COM"
|
||||
},
|
||||
"pgAdmin4_test_user_credentials": {
|
||||
"new_password": "NEWPASSWORD",
|
||||
"login_password": "PASSWORD",
|
||||
"login_username": "USER2@EXAMPLE.COM"
|
||||
},
|
||||
"pgAdmin4_test_non_admin_credentials": {
|
||||
"new_password": "NEWPASSWORD",
|
||||
"login_password": "PASSWORD",
|
||||
"login_username": "USER@EXAMPLE.COM"
|
||||
},
|
||||
"server_group": 1,
|
||||
"server_credentials": [
|
||||
{
|
||||
"name": "PostgreSQL ${{ matrix.pgver }}",
|
||||
"comment": "PostgreSQL ${{ matrix.pgver }} Server",
|
||||
"db_username": "postgres",
|
||||
"host": "/var/run/postgresql",
|
||||
"db_password": "postgres",
|
||||
"db_port": 59${{ matrix.pgver }},
|
||||
"maintenance_db": "postgres",
|
||||
"sslmode": "prefer",
|
||||
"tablespace_path": "/var/lib/postgresql/tablespaces/${{ matrix.pgver }}",
|
||||
"enabled": true,
|
||||
"default_binary_paths": {
|
||||
"pg": "/usr/lib/postgresql/${{ matrix.pgver }}/bin",
|
||||
"ppas": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"server_update_data": [
|
||||
{
|
||||
"comment": "This is test update comment"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
- name: Build the JS bundle
|
||||
run: |
|
||||
cd web
|
||||
yarn install
|
||||
yarn run bundle
|
||||
|
||||
- name: Run the tests
|
||||
run: |
|
||||
. venv/bin/activate
|
||||
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
|
||||
export DISPLAY=:99
|
||||
cd web
|
||||
python regression/runtests.py --pkg feature_tests
|
||||
|
||||
- name: Archive server log
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: server-log-pg${{ matrix.pgver }}
|
||||
path: var/pgadmin4.log
|
||||
|
||||
- name: Archive regression log
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: regression-log-pg${{ matrix.pgver }}
|
||||
path: web/regression/regression.log
|
||||
|
||||
- name: Archive screenshots
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: screenshots-pg${{ matrix.pgver }}
|
||||
path: web/regression/screenshots
|
||||
if-no-files-found: ignore
|
Loading…
Reference in New Issue
Block a user