Skip to content

Commit

Permalink
Fix tests for GPDB 7 (#44)
Browse files Browse the repository at this point in the history
The tests failed if it ran with GPDB 7. This patch makes the following changes:

1. In `test_create_extension` (both in regress and isolation2) use
`default_table_access_method` GUC instead of `gp_default_storage_options`
since `gp_default_storage_options` can't be used for appendonly in GPDB 7.
Since we can't choose which one to use, we run both, expecting one of them to
fail.
2. In `test_activetable_limit` and `test_rejectmap_limit` (regress) change log
reading function to read from either `pg_logs` or `logs`, depending on which
one is available.
3. In `test_dropped_table` and `test_temporary_table` (isolation2) add
matchsubs to account for different command output on GPDB 7.
4. Update README to indicate support for GPDB 7 on Ubuntu 22.

Ticket: ADBDEV-6699
  • Loading branch information
silent-observer authored Dec 2, 2024
1 parent 767d498 commit 0d2375a
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 33 deletions.
16 changes: 12 additions & 4 deletions arenadata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,34 @@
You can build your Docker image from GPDB source or use prebuilt images from hub.adsw.io.
How to build Docker image: (["readme.md"](https://github.com/arenadata/gpdb/blob/f7ff7c8ecae4ce7ab3b73fd46171cdaa457b3591/arenadata/readme.md)).

## Supported GPDB images

- `hub.adsw.io/library/gpdb6_regress:latest`
- `hub.adsw.io/library/gpdb6_u22:latest`
- `hub.adsw.io/library/gpdb7_u22:latest`

## Steps to run tests

1. Download the cmake-3.20 install script from ([source](https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0-linux-x86_64.sh)).

2. Build diskquota in the Docker container.
Change <PATH_TO_DISKQUOTA_SRC> and <PATH_TO_CMAKE_INSTALL_SCRIPT> to the appropriate paths on your local machine.
Change <PATH_TO_DISKQUOTA_SRC> and <PATH_TO_CMAKE_INSTALL_SCRIPT> to the appropriate paths on your local machine, and <IMAGE> to a supported GPDB docker image.

```
docker run --rm -it -e DISKQUOTA_OS=rhel7 \
-v /tmp/diskquota_artifacts:/home/gpadmin/diskquota_artifacts \
-v <PATH_TO_DISKQUOTA_SRC>:/home/gpadmin/diskquota_src \
-v <PATH_TO_CMAKE_INSTALL_SCRIPT>:/home/gpadmin/bin_cmake/cmake-3.20.0-linux-x86_64.sh \
hub.adsw.io/library/gpdb6_regress:latest diskquota_src/concourse/scripts/entry.sh build
<IMAGE> diskquota_src/concourse/scripts/entry.sh build
```

3. Run tests.
Change <PATH_TO_DISKQUOTA_SRC> and <PATH_TO_CMAKE_INSTALL_SCRIPT> to the appropriate paths on your local machine.
Change <PATH_TO_DISKQUOTA_SRC> and <PATH_TO_CMAKE_INSTALL_SCRIPT> to the appropriate paths on your local machine, and <IMAGE> to a supported GPDB docker image.

```
docker run --rm -it --sysctl 'kernel.sem=500 1024000 200 4096' \
-v /tmp/diskquota_artifacts:/home/gpadmin/bin_diskquota \
-v <PATH_TO_DISKQUOTA_SRC>:/home/gpadmin/diskquota_src \
-v <PATH_TO_CMAKE_INSTALL_SCRIPT>:/home/gpadmin/bin_cmake/cmake-3.20.0-linux-x86_64.sh \
hub.adsw.io/library/gpdb6_regress:latest diskquota_src/concourse/scripts/entry.sh test
<IMAGE> diskquota_src/concourse/scripts/entry.sh test
```
16 changes: 16 additions & 0 deletions tests/init_file
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,20 @@ s/ERROR: tablespace: \d+, schema: \d+ diskquota exceeded.*/[hardlimit] tablespa
m/^ERROR: Can not set disk quota for system owner:.*/
s/^ERROR: Can not set disk quota for system owner:.*/ERROR: Can not set disk quota from system owner:/

# GPDB 7 differences
m/CREATE EXTENSION$/
s/CREATE EXTENSION$/CREATE/
m/DROP EXTENSION$/
s/DROP EXTENSION$/DROP/
m/CREATE SCHEMA$/
s/CREATE SCHEMA$/CREATE/
m/CREATE TABLE$/
s/CREATE TABLE$/CREATE/
m/INSERT 0 \d+$/
s/INSERT 0 (\d+)$/INSERT $1/
m/DROP SCHEMA$/
s/DROP SCHEMA$/DROP/
m/DROP TABLE$/
s/DROP TABLE$/DROP/

-- end_matchsubs
4 changes: 0 additions & 4 deletions tests/isolation2/expected/test_create_extension.out
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
-- check that diskquota ignores global flag appendonly=true

SET gp_default_storage_options='appendonly=true';
SET

CREATE EXTENSION diskquota;
CREATE
DROP EXTENSION diskquota;
DROP

SET gp_default_storage_options='appendonly=false';
SET

CREATE EXTENSION diskquota;
CREATE
Expand Down
15 changes: 0 additions & 15 deletions tests/isolation2/expected7/test_create_extension.out

This file was deleted.

16 changes: 14 additions & 2 deletions tests/isolation2/sql/test_create_extension.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
-- check that diskquota ignores global flag appendonly=true

SET gp_default_storage_options='appendonly=true';
-- start_ignore
SELECT CASE
WHEN current_setting('server_version_num')::int > 120000
THEN set_config('default_table_access_method', 'ao_row', false)
ELSE set_config('gp_default_storage_options', 'appendonly=true', false)
END;
-- end_ignore

CREATE EXTENSION diskquota;
DROP EXTENSION diskquota;

SET gp_default_storage_options='appendonly=false';
-- start_ignore
SELECT CASE
WHEN current_setting('server_version_num')::int > 120000
THEN set_config('default_table_access_method', 'heap', false)
ELSE set_config('gp_default_storage_options', 'appendonly=false', false)
END;
-- end_ignore

CREATE EXTENSION diskquota;

Expand Down
6 changes: 5 additions & 1 deletion tests/regress/expected/test_activetable_limit.out
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ INSERT INTO a03 values(generate_series(0, 500));
CREATE EXTENSION diskquota;
-- we only read the current log file
CREATE EXTERNAL WEB TABLE segment_logs(line text)
EXECUTE 'cat $GP_SEG_DATADIR/pg_log/$(ls -Art $GP_SEG_DATADIR/pg_log | tail -n 1)'
EXECUTE 'if [ -d "$GP_SEG_DATADIR/pg_log" ]; then
cat $GP_SEG_DATADIR/pg_log/$(ls -Art $GP_SEG_DATADIR/pg_log | tail -n 1)
else
cat $GP_SEG_DATADIR/log/$(ls -Art $GP_SEG_DATADIR/log | tail -n 1)
fi'
ON ALL FORMAT 'TEXT' (DELIMITER 'OFF');
CREATE SCHEMA s;
SELECT diskquota.set_schema_quota('s', '1 MB');
Expand Down
2 changes: 0 additions & 2 deletions tests/regress/expected/test_create_extension.out
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
-- check that diskquota ignores global flag appendonly=true
SET gp_default_storage_options='appendonly=true';
CREATE EXTENSION diskquota;
DROP EXTENSION diskquota;
SET gp_default_storage_options='appendonly=false';
CREATE EXTENSION diskquota;
SELECT diskquota.init_table_size_table();
init_table_size_table
Expand Down
6 changes: 5 additions & 1 deletion tests/regress/expected/test_rejectmap_limit.out
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ SELECT diskquota.wait_for_worker_new_epoch();

-- we only read the current log file
CREATE EXTERNAL WEB TABLE master_log(line text)
EXECUTE 'cat $GP_SEG_DATADIR/pg_log/$(ls -Art $GP_SEG_DATADIR/pg_log | tail -n 1)'
EXECUTE 'if [ -d "$GP_SEG_DATADIR/pg_log" ]; then
cat $GP_SEG_DATADIR/pg_log/$(ls -Art $GP_SEG_DATADIR/pg_log | tail -n 1)
else
cat $GP_SEG_DATADIR/log/$(ls -Art $GP_SEG_DATADIR/log | tail -n 1)
fi'
ON MASTER FORMAT 'TEXT' (DELIMITER 'OFF');
CREATE SCHEMA s1;
CREATE SCHEMA s2;
Expand Down
6 changes: 5 additions & 1 deletion tests/regress/sql/test_activetable_limit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ INSERT INTO a03 values(generate_series(0, 500));
CREATE EXTENSION diskquota;
-- we only read the current log file
CREATE EXTERNAL WEB TABLE segment_logs(line text)
EXECUTE 'cat $GP_SEG_DATADIR/pg_log/$(ls -Art $GP_SEG_DATADIR/pg_log | tail -n 1)'
EXECUTE 'if [ -d "$GP_SEG_DATADIR/pg_log" ]; then
cat $GP_SEG_DATADIR/pg_log/$(ls -Art $GP_SEG_DATADIR/pg_log | tail -n 1)
else
cat $GP_SEG_DATADIR/log/$(ls -Art $GP_SEG_DATADIR/log | tail -n 1)
fi'
ON ALL FORMAT 'TEXT' (DELIMITER 'OFF');

CREATE SCHEMA s;
Expand Down
16 changes: 14 additions & 2 deletions tests/regress/sql/test_create_extension.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
-- check that diskquota ignores global flag appendonly=true

SET gp_default_storage_options='appendonly=true';
-- start_ignore
SELECT CASE
WHEN current_setting('server_version_num')::int > 120000
THEN set_config('default_table_access_method', 'ao_row', false)
ELSE set_config('gp_default_storage_options', 'appendonly=true', false)
END;
-- end_ignore

CREATE EXTENSION diskquota;
DROP EXTENSION diskquota;

SET gp_default_storage_options='appendonly=false';
-- start_ignore
SELECT CASE
WHEN current_setting('server_version_num')::int > 120000
THEN set_config('default_table_access_method', 'heap', false)
ELSE set_config('gp_default_storage_options', 'appendonly=false', false)
END;
-- end_ignore

CREATE EXTENSION diskquota;

Expand Down
6 changes: 5 additions & 1 deletion tests/regress/sql/test_rejectmap_limit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ CREATE EXTENSION diskquota;
SELECT diskquota.wait_for_worker_new_epoch();
-- we only read the current log file
CREATE EXTERNAL WEB TABLE master_log(line text)
EXECUTE 'cat $GP_SEG_DATADIR/pg_log/$(ls -Art $GP_SEG_DATADIR/pg_log | tail -n 1)'
EXECUTE 'if [ -d "$GP_SEG_DATADIR/pg_log" ]; then
cat $GP_SEG_DATADIR/pg_log/$(ls -Art $GP_SEG_DATADIR/pg_log | tail -n 1)
else
cat $GP_SEG_DATADIR/log/$(ls -Art $GP_SEG_DATADIR/log | tail -n 1)
fi'
ON MASTER FORMAT 'TEXT' (DELIMITER 'OFF');

CREATE SCHEMA s1;
Expand Down

0 comments on commit 0d2375a

Please sign in to comment.