Skip to content

2.25.0.0-b63

tagged this 30 Sep 15:44
Summary:
This diff ports pg_partman test suite which was added by import of pg_partman extension D36360

- These tests will run via running pg_prove shell command . Each test will provide the test file path for which to run the test.

```
TEST_F(PgPartmanTest, TestIdNative) { RunAndAssertTest("test_native/yb_pg_test-id-native.sql"); }

 void RunAndAssertTest(const std::string& test_file_name) {
    std::string test_file = JoinPathSegments(test_dir_partman_, test_file_name);
    std::string output;
    auto flag = RunShellProcess(Format("$0 $1", test_command_, test_file), &output);
    LOG(INFO) << "output = " << output;
    ASSERT_EQ(flag, true);
  }

Status InitializeTestCommand() {
    test_command_ = Format("pg_prove -U $0 -d $1 -h localhost -p $2", user_, database_, port_);
    return Status::OK();
  }
```

There are some changes to the tests files to make them YB compatible. For that corresponding new files with `yb_pg_` prefix are created. Changes include:

- Every pgtap test is inside a `BEGIN` and `ROLLBACK` block to restore the DB state after running test. But since transactional DDL is not supported in YB and
     all the test files are run as a single test, removed BEGIN and ROLLBACK calls.

```
-- BEGIN;
SELECT set_config('search_path','partman, public',false);
```

- Some tests creates template table as unlogged table. Unlogged table creation is not supported. Replace unlogged table creation with non-unlogged (normal) table creation.

```
CREATE TABLE partman_test.template_id_taptest_table (LIKE partman_test.id_taptest_table); -- YB: remove unlogged table creation
```

- Most of the test at the end calls `undo_partition` function and does some PgTap test assertions . Diff D36771 disabled undo_partition function. Commented out calls in all modified tests.

- Remove `p_retention_schema` parameter in drop_partition_{id/time} calls. Diff D36427 disabled `p_retention_schema` parameter.

- `yb_pg_test-id-procedure-source-table-part*.sql` : Reduced number of rows inserted by factor of 10 to complete the test within timeout.

- `yb_pg_test-time-daily-native-tablespace-template.sql`:  Not set tablespace for primary key index

```
-- ALTER INDEX partman_test.time_taptest_table_template_pkey SET TABLESPACE mytablespace ; --YB:  cannot set tablespace for primary key index
```
Jira: DB-12234

Test Plan: Jenkins: test regex: PgPartmanTest*

Reviewers: hsunder, skumar, jason

Reviewed By: skumar, jason

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D36751
Assets 2
Loading