Skip to content

Commit 282a956

Browse files
authored
Reverted changes in Python tests for EPAS/PG YAML files that were added to support Subscription RESQL test cases and adjust streaming values for PG v16+.
1 parent 00dbe58 commit 282a956

20 files changed

Lines changed: 49 additions & 109 deletions

.github/workflows/run-python-tests-epas.yml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
run: |
6666
FOR /f "delims=" %%F IN ('python tools\get_sb_package.py "${{ secrets.EDB_SBP_URL }}" "edb_as${{ matrix.pgver }}_dbserver" "windows-x64"') DO SET INSTALLER_EXE=%%F
6767
ECHO Running %INSTALLER_EXE%...
68-
%INSTALLER_EXE% --prefix C:\EPAS\${{ matrix.pgver }} --datadir C:\EPAS\${{ matrix.pgver }}\data --serverport 59${{ matrix.pgver }} --superpassword enterprisedb --create_samples no --install_runtimes 0 --mode unattended --unattendedmodeui none --disable-components stackbuilderplus${{ matrix.pgver < 15 && ',pgadmin4' || '' }}
68+
%INSTALLER_EXE% --prefix C:\EPAS\${{ matrix.pgver }} --datadir C:\EPAS\${{ matrix.pgver }}\data --serverport 58${{ matrix.pgver }} --superpassword enterprisedb --create_samples no --install_runtimes 0 --mode unattended --unattendedmodeui none --disable-components stackbuilderplus${{ matrix.pgver < 15 && ',pgadmin4' || '' }}
6969
7070
choco install -y mitkerberos
7171
@@ -105,38 +105,23 @@ jobs:
105105
run: |
106106
# Note: we use a custom port for PostgreSQL as the runner may already have a version of PostgreSQL installed
107107
sudo su -c "echo local all all trust > /etc/edb-as/${{ matrix.pgver }}/main/pg_hba.conf"
108-
sudo su -c "echo host all all 127.0.0.1/32 trust >> /etc/edb-as/${{ matrix.pgver }}/main/pg_hba.conf"
109-
sudo su -c "echo host all all ::1/128 trust >> /etc/edb-as/${{ matrix.pgver }}/main/pg_hba.conf"
110-
sudo su -c "echo host replication postgres 127.0.0.1/32 trust >> /etc/edb-as/${{ matrix.pgver }}/main/pg_hba.conf"
111-
sudo su -c "echo host replication postgres ::1/128 trust >> /etc/edb-as/${{ matrix.pgver }}/main/pg_hba.conf"
112-
sudo sed -i "s/port = 544[0-9]/port = 59${{ matrix.pgver }}/g" /etc/edb-as/${{ matrix.pgver }}/main/postgresql.conf
108+
sudo sed -i "s/port = 544[0-9]/port = 58${{ matrix.pgver }}/g" /etc/edb-as/${{ matrix.pgver }}/main/postgresql.conf
113109
sudo sed -i "s/shared_preload_libraries = '/shared_preload_libraries = '\$libdir\/plugin_debugger,/g" /etc/edb-as/${{ matrix.pgver }}/main/postgresql.conf
114-
echo "wal_level = logical" | sudo tee -a /etc/edb-as/${{ matrix.pgver }}/main/postgresql.conf
115110
sudo su - enterprisedb -c "mkdir -p /var/run/edb-as/${{ matrix.pgver }}-main.epas_stat_tmp"
116111
sudo systemctl restart edb-as@${{ matrix.pgver }}-main
117112
118-
until sudo runuser -l enterprisedb -c "/usr/lib/edb-as/${{ matrix.pgver }}/bin/pg_isready -p 59${{ matrix.pgver }}" 2>/dev/null; do
113+
until sudo runuser -l enterprisedb -c "/usr/lib/edb-as/${{ matrix.pgver }}/bin/pg_isready -p 58${{ matrix.pgver }}" 2>/dev/null; do
119114
>&2 echo "EPAS is unavailable - sleeping for 2 seconds"
120115
sleep 2
121116
done
122117
123-
- name: Start PostgreSQL on Windows
124-
if: ${{ matrix.os == 'windows-latest' }}
125-
run: |
126-
echo host replication postgres 127.0.0.1/32 trust >> "C:\EPAS\${{ matrix.pgver }}\data\pg_hba.conf"
127-
echo host replication postgres ::1/128 trust >> "C:\EPAS\${{ matrix.pgver }}\data\pg_hba.conf"
128-
echo wal_level = logical >> "C:\EPAS\${{ matrix.pgver }}\data\postgresql.conf"
129-
net stop edb-as-${{ matrix.pgver }}
130-
net start edb-as-${{ matrix.pgver }}
131-
shell: cmd
132-
133118
- name: Create pgagent extension on Linux
134119
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.pgver <= 16 }}
135-
run: psql -U enterprisedb -d postgres -p 59${{ matrix.pgver }} -c 'CREATE EXTENSION IF NOT EXISTS pgagent;'
120+
run: psql -U enterprisedb -d postgres -p 58${{ matrix.pgver }} -c 'CREATE EXTENSION IF NOT EXISTS pgagent;'
136121

137122
- name: Create postgis extension on Linux
138123
if: ${{ matrix.os == 'ubuntu-22.04' }}
139-
run: psql -U enterprisedb -d postgres -p 59${{ matrix.pgver }} -c 'CREATE EXTENSION IF NOT EXISTS postgis;'
124+
run: psql -U enterprisedb -d postgres -p 58${{ matrix.pgver }} -c 'CREATE EXTENSION IF NOT EXISTS postgis;'
140125

141126
- name: Install Python dependencies on Linux
142127
if: ${{ matrix.os == 'ubuntu-22.04' }}
@@ -206,7 +191,7 @@ jobs:
206191
"db_username": "enterprisedb",
207192
"host": "/var/run/edb-as",
208193
"db_password": "",
209-
"db_port": 59${{ matrix.pgver }},
194+
"db_port": 58${{ matrix.pgver }},
210195
"maintenance_db": "postgres",
211196
"sslmode": "prefer",
212197
"tablespace_path": "/var/lib/edb-as/tablespaces/${{ matrix.pgver }}",
@@ -280,7 +265,7 @@ jobs:
280265
@echo. "db_username": "enterprisedb",
281266
@echo. "host": "127.0.0.1",
282267
@echo. "db_password": "enterprisedb",
283-
@echo. "db_port": 59${{ matrix.pgver }},
268+
@echo. "db_port": 58${{ matrix.pgver }},
284269
@echo. "maintenance_db": "postgres",
285270
@echo. "sslmode": "prefer",
286271
@echo. "tablespace_path": "C:\\EPAS\\${{ matrix.pgver }}\\tablespaces",

.github/workflows/run-python-tests-pg.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,8 @@ jobs:
116116
if: ${{ matrix.os == 'ubuntu-22.04' }}
117117
run: |
118118
sudo su -c "echo local all all trust > /etc/postgresql/${{ matrix.pgver }}/main/pg_hba.conf"
119-
sudo su -c "echo host all all 127.0.0.1/32 trust >> /etc/postgresql/${{ matrix.pgver }}/main/pg_hba.conf"
120-
sudo su -c "echo host all all ::1/128 trust >> /etc/postgresql/${{ matrix.pgver }}/main/pg_hba.conf"
121-
sudo su -c "echo host replication postgres 127.0.0.1/32 trust >> /etc/postgresql/${{ matrix.pgver }}/main/pg_hba.conf"
122-
sudo su -c "echo host replication postgres ::1/128 trust >> /etc/postgresql/${{ matrix.pgver }}/main/pg_hba.conf"
123119
sudo sed -i "s/port = 543[0-9]/port = 59${{ matrix.pgver }}/g" /etc/postgresql/${{ matrix.pgver }}/main/postgresql.conf
124120
sudo sed -i "s/#shared_preload_libraries = ''/shared_preload_libraries = '\$libdir\/plugin_debugger'/g" /etc/postgresql/${{ matrix.pgver }}/main/postgresql.conf
125-
echo "wal_level = logical" | sudo tee -a /etc/postgresql/${{ matrix.pgver }}/main/postgresql.conf
126121
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 &"
127122
128123
until sudo runuser -l postgres -c "pg_isready -p 59${{ matrix.pgver }}" 2>/dev/null; do
@@ -138,12 +133,7 @@ jobs:
138133
if: ${{ matrix.os == 'macos-latest' }}
139134
run: |
140135
echo local all all trust > /opt/homebrew/var/postgresql@${{ matrix.pgver }}/pg_hba.conf
141-
echo 'host all all 127.0.0.1/32 trust' >> /opt/homebrew/var/postgresql@${{ matrix.pgver }}/pg_hba.conf
142-
echo 'host all all ::1/128 trust' >> /opt/homebrew/var/postgresql@${{ matrix.pgver }}/pg_hba.conf
143-
echo 'host replication postgres 127.0.0.1/32 trust' >> /opt/homebrew/var/postgresql@${{ matrix.pgver }}/pg_hba.conf
144-
echo 'host replication postgres ::1/128 trust' >> /opt/homebrew/var/postgresql@${{ matrix.pgver }}/pg_hba.conf
145136
sed -i '' "s/#port = 543[0-9]/port = 59${{ matrix.pgver }}/g" /opt/homebrew/var/postgresql@${{ matrix.pgver }}/postgresql.conf
146-
echo "wal_level = logical" >> /opt/homebrew/var/postgresql@${{ matrix.pgver }}/postgresql.conf
147137
brew services restart postgresql@${{ matrix.pgver }}
148138
149139
until /opt/homebrew/opt/postgresql@${{ matrix.pgver }}/bin/pg_isready -p 59${{ matrix.pgver }} 2>/dev/null; do
@@ -153,16 +143,6 @@ jobs:
153143
154144
psql postgres -p 59${{ matrix.pgver }} -c 'CREATE ROLE postgres SUPERUSER LOGIN;'
155145
156-
- name: Start PostgreSQL on Windows
157-
if: ${{ matrix.os == 'windows-latest' }}
158-
run: |
159-
echo host replication postgres 127.0.0.1/32 trust >> "C:\PostgreSQL\${{ matrix.pgver }}\data\pg_hba.conf"
160-
echo host replication postgres ::1/128 trust >> "C:\PostgreSQL\${{ matrix.pgver }}\data\pg_hba.conf"
161-
echo wal_level = logical >> "C:\PostgreSQL\${{ matrix.pgver }}\data\postgresql.conf"
162-
net stop postgresql-x64-${{ matrix.pgver }}
163-
net start postgresql-x64-${{ matrix.pgver }}
164-
shell: cmd
165-
166146
- name: Install Python dependencies on Linux and macOS
167147
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'ubuntu-22.04' }}
168148
run: make install-python-testing

web/pgadmin/browser/server_groups/servers/databases/subscriptions/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ class SubscriptionView(PGChildNodeView)
184184
# This mapping will be used PostgresSQL 16 above
185185
streaming_mapping = {
186186
'p': 'parallel',
187-
't': True,
188-
'f': False
187+
't': 'on',
188+
'f': 'off'
189189
}
190190
two_phase_mapping = {
191191
'p': True,

web/pgadmin/browser/server_groups/servers/databases/subscriptions/static/js/subscription.ui.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import BaseUISchema from 'sources/SchemaView/base_schema.ui';
1111
import { isEmptyString } from 'sources/validators';
1212
import _ from 'lodash';
1313

14+
function getDefaultStreaming(version) {
15+
if (version >= 180000) return 'parallel';
16+
if (version >= 160000) return 'off';
17+
return false;
18+
}
19+
1420
export default class SubscriptionSchema extends BaseUISchema{
1521
constructor(fieldOptions={}, node_info={}, initValues={}) {
1622
super({
@@ -26,7 +32,7 @@ export default class SubscriptionSchema extends BaseUISchema{
2632
binary:false,
2733
two_phase:false,
2834
disable_on_error:false,
29-
streaming: (node_info?.node_info?.version >= 180000) ? 'parallel' : false,
35+
streaming: getDefaultStreaming(node_info?.node_info?.version),
3036
password_required:true,
3137
run_as_owner:false,
3238
origin:'any',
@@ -386,24 +392,19 @@ export default class SubscriptionSchema extends BaseUISchema{
386392
cell: 'text',
387393
group: gettext('With'), mode: ['create', 'edit', 'properties'],
388394
type: ()=>{
389-
let options = [
390-
{
391-
'label': gettext('On'),
392-
value: true,
393-
},
394-
{
395-
'label': gettext('Off'),
396-
value: false,
397-
}
398-
];
399-
395+
let options;
400396
if (obj.version >= 160000) {
401-
options.push({
402-
'label': gettext('Parallel'),
403-
value: 'parallel',
404-
});
397+
options = [
398+
{ label: gettext('On'), value: 'on' },
399+
{ label: gettext('Off'), value: 'off' },
400+
{ label: gettext('Parallel'), value: 'parallel' },
401+
];
402+
} else {
403+
options = [
404+
{ label: gettext('On'), value: true },
405+
{ label: gettext('Off'), value: false },
406+
];
405407
}
406-
407408
return {
408409
type: 'toggle',
409410
options: options,

web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/16_plus/alter_parameters.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
CREATE SUBSCRIPTION test_create_subscription
66
CONNECTION 'host=localhost port=5434 user=postgres dbname=postgres connect_timeout=10 sslmode=prefer'
77
PUBLICATION test_pub
8-
WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off', binary = false, streaming = 'False', two_phase = true, disable_on_error = false, run_as_owner = true, password_required = true, origin = 'none');
8+
WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off', binary = false, streaming = 'parallel', two_phase = true, disable_on_error = false, run_as_owner = true, password_required = true, origin = 'none');
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
ALTER SUBSCRIPTION test_create_subscription
2-
SET (synchronous_commit = 'off', binary = false, streaming = 'False', disable_on_error = false, origin = 'none');
2+
SET (synchronous_commit = 'off', binary = false, streaming = 'parallel', disable_on_error = false, origin = 'none');

web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/16_plus/create_subscription.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
CREATE SUBSCRIPTION test_create_subscription
66
CONNECTION 'host=localhost port=5434 user=postgres dbname=postgres connect_timeout=10 sslmode=prefer'
77
PUBLICATION test_pub
8-
WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'remote_apply', binary = true, streaming = 'True', two_phase = true, disable_on_error = true, run_as_owner = true, password_required = true, origin = 'any');
8+
WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'remote_apply', binary = true, streaming = 'on', two_phase = true, disable_on_error = true, run_as_owner = true, password_required = true, origin = 'any');
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
CREATE SUBSCRIPTION test_create_subscription
22
CONNECTION 'host=localhost port=5434 user=postgres dbname=postgres connect_timeout=10 password=xxxxxx sslmode=prefer'
33
PUBLICATION test_pub
4-
WITH (connect = false, enabled = false, copy_data = false, create_slot = false, slot_name = None, synchronous_commit = 'remote_apply', binary = true, streaming = 'True', two_phase = true, disable_on_error = true, run_as_owner = true, password_required = true, origin = 'any');
4+
WITH (connect = false, enabled = false, copy_data = false, create_slot = false, slot_name = None, synchronous_commit = 'remote_apply', binary = true, streaming = 'on', two_phase = true, disable_on_error = true, run_as_owner = true, password_required = true, origin = 'any');

web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/16_plus/test.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"password": "edb",
2424
"sync": "remote_apply",
2525
"binary": true,
26-
"streaming": true,
26+
"streaming": "on",
2727
"disable_on_error": true,
2828
"two_phase": true,
2929
"password_required": true,
@@ -44,7 +44,7 @@
4444
"data": {
4545
"sync": "off",
4646
"binary": false,
47-
"streaming": false,
47+
"streaming": "parallel",
4848
"disable_on_error": false,
4949
"origin": "none"
5050
},

web/pgadmin/browser/server_groups/servers/databases/subscriptions/tests/17_plus/alter_failover_parameter.sql

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)