diff --git a/gpMgmt/test/behave/mgmt_utils/backup_and_restore_backups.feature b/gpMgmt/test/behave/mgmt_utils/backup_and_restore_backups.feature index b29691ed88603a0636a16d1cc7ad4d5ed5a34f9e..e1e886c1547fd6ec1c2859f910a7e73286bd403c 100644 --- a/gpMgmt/test/behave/mgmt_utils/backup_and_restore_backups.feature +++ b/gpMgmt/test/behave/mgmt_utils/backup_and_restore_backups.feature @@ -1626,121 +1626,95 @@ Feature: Validate command line arguments Scenario: 120 Simple full backup and restore with special character Given the backup test is initialized for special characters - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB"" And the timestamp from gpcrondump is stored Then gpcrondump should return a return code of 0 - When the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/120_special_table_data.ans" + When the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql "$SP_CHAR_DB" > /tmp/120_special_table_data.ans" Scenario: 121 gpcrondump with -T option where table name, schema name and database name contains special character Given the backup test is initialized for special characters - And a list of files "121_ao,121_heap" of tables " S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . ao_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 , S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . heap_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " exists for validation - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " -T " S\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 "." co_T\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 "" + And a list of files "121_ao,121_heap" of tables "$SP_CHAR_SCHEMA.$SP_CHAR_AO,$SP_CHAR_SCHEMA.$SP_CHAR_HEAP" in "$SP_CHAR_DB" exists for validation + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB" -T "$SP_CHAR_SCHEMA"."$SP_CHAR_CO"" Then gpcrondump should return a return code of 0 And the timestamp from gpcrondump is stored Scenario: 122 gpcrondump with --exclude-table-file option where table name, schema name and database name contains special character Given the backup test is initialized for special characters - And a list of files "122_ao,122_heap" of tables " S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . ao_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 , S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . heap_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " exists for validation - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " --exclude-table-file test/behave/mgmt_utils/steps/data/special_chars/exclude-table-file.txt" + And a list of files "122_ao,122_heap" of tables "$SP_CHAR_SCHEMA.$SP_CHAR_AO,$SP_CHAR_SCHEMA.$SP_CHAR_HEAP" in "$SP_CHAR_DB" exists for validation + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB" --exclude-table-file test/behave/mgmt_utils/steps/data/special_chars/exclude-table-file.txt" Then gpcrondump should return a return code of 0 And the timestamp from gpcrondump is stored Scenario: 123 gpcrondump with --table-file option where table name, schema name and database name contains special character Given the backup test is initialized for special characters - And a list of files "123_ao,123_heap" of tables " S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . ao_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 , S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . heap_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " exists for validation - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " --table-file test/behave/mgmt_utils/steps/data/special_chars/table-file.txt" + And a list of files "123_ao,123_heap" of tables "$SP_CHAR_SCHEMA.$SP_CHAR_AO,$SP_CHAR_SCHEMA.$SP_CHAR_HEAP" in "$SP_CHAR_DB" exists for validation + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB" --table-file test/behave/mgmt_utils/steps/data/special_chars/table-file.txt" Then gpcrondump should return a return code of 0 And the timestamp from gpcrondump is stored Scenario: 124 gpcrondump with -t option where table name, schema name and database name contains special character Given the backup test is initialized for special characters - And a list of files "124_ao" of tables " S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . ao_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " exists for validation - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " -t " S\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 "." ao_T\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 "" + And a list of files "124_ao" of tables "$SP_CHAR_SCHEMA.$SP_CHAR_AO" in "$SP_CHAR_DB" exists for validation + When the user runs "gpcrondump -a -x "$SP_CHAR_DB" -t "$SP_CHAR_SCHEMA"."$SP_CHAR_AO"" Then gpcrondump should return a return code of 0 And the timestamp from gpcrondump is stored Scenario: 125 gpcrondump with --schema-file option when schema name and database name contains special character Given the backup test is initialized for special characters - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " --schema-file test/behave/mgmt_utils/steps/data/special_chars/schema-file.txt" + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB" --schema-file test/behave/mgmt_utils/steps/data/special_chars/schema-file.txt" Then gpcrondump should return a return code of 0 And the timestamp from gpcrondump is stored - And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/125_special_table_data.ans" + And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql "$SP_CHAR_DB" > /tmp/125_special_table_data.ans" Scenario: 126 gpcrondump with -s option when schema name and database name contains special character Given the backup test is initialized for special characters - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " -s " S\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 "" + When the user runs "gpcrondump -a -x "$SP_CHAR_DB" -s "$SP_CHAR_SCHEMA"" Then gpcrondump should return a return code of 0 And the timestamp from gpcrondump is stored - And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/126_special_table_data.ans" + And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql "$SP_CHAR_DB" > /tmp/126_special_table_data.ans" Scenario: 127 gpcrondump with --exclude-schema-file option when schema name and database name contains special character Given the backup test is initialized for special characters - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " --exclude-schema-file test/behave/mgmt_utils/steps/data/special_chars/schema-file.txt" + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB" --exclude-schema-file test/behave/mgmt_utils/steps/data/special_chars/schema-file.txt" Then gpcrondump should return a return code of 0 And the timestamp from gpcrondump is stored Scenario: 128 gpcrondump with -S option when schema name and database name contains special character Given the backup test is initialized for special characters - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " -S " S\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 "" - Then gpcrondump should return a return code of 0 - And the timestamp from gpcrondump is stored - - Scenario: 129 Gpdbrestore with --table-file option when table name, schema name and database name contains special character - Given the backup test is initialized for special characters - And a list of files "129_ao,129_heap" of tables " S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . ao_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 , S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . heap_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " exists for validation - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB" -S "$SP_CHAR_SCHEMA"" Then gpcrondump should return a return code of 0 And the timestamp from gpcrondump is stored Scenario: 130 Gpdbrestore with -T, --truncate, and --change-schema options when table name, schema name and database name contains special character Given the backup test is initialized for special characters - And the user runs command "psql -f psql -c """select * from \" S\`~@#\$%^&*()-+[{]}|\\;: \\'\"\"/?><1 \".\" ao_T\`~@#\$%^&*()-+[{]}|\\;: \\'\"\"/?><1 \" order by 1""" -d " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/130_table_data.ans" - And the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + And the user runs command "psql -f psql -c """select * from \"$SP_CHAR_SCHEMA\".\"$SP_CHAR_AO\" order by 1""" -d "$SP_CHAR_DB" > /tmp/130_table_data.ans" + And the user runs command "gpcrondump -a -x "$SP_CHAR_DB"" Then gpcrondump should return a return code of 0 And the timestamp from gpcrondump is stored Scenario: 131 gpcrondump with --incremental option when table name, schema name and database name contains special character Given the backup test is initialized for special characters - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB"" Then gpcrondump should return a return code of 0 Given the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/insert_into_special_table.sql template1" - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " --incremental" + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB" --incremental" Then gpcrondump should return a return code of 0 And the timestamp from gpcrondump is stored - When the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/131_special_table_data.ans" + When the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql "$SP_CHAR_DB" > /tmp/131_special_table_data.ans" Scenario: 132 gpdbrestore with --redirect option with special db name, and all table name, schema name and database name contain special character Given the backup test is initialized for special characters - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB"" Then gpcrondump should return a return code of 0 And the timestamp from gpcrondump is stored - When the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/132_special_table_data.ans" + When the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql "$SP_CHAR_DB" > /tmp/132_special_table_data.ans" Scenario: 133 gpdbrestore, -S option, -S truncate option schema level restore with special chars in schema name Given the backup test is initialized for special characters - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" - Then gpcrondump should return a return code of 0 - And the timestamp from gpcrondump is stored - When the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/133_special_table_data.ans" - - Scenario: 134 gpdbrestore, --noplan option with special chars in database name, schema name, and table name - Given the backup test is initialized for special characters - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" - Then gpcrondump should return a return code of 0 - Given the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/insert_into_special_ao_table.sql template1" - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " --incremental" - Then gpcrondump should return a return code of 0 - And the timestamp from gpcrondump is stored - When the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_ao_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/134_special_ao_table_data.ans" - - Scenario: 135 Gpdbrestore, --change-schema option does not work with -S schema level restore option - Given the backup test is initialized for special characters - And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_database.sql template1" - And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_schema.sql template1" - And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_table.sql template1" - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB"" Then gpcrondump should return a return code of 0 And the timestamp from gpcrondump is stored + When the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql "$SP_CHAR_DB" > /tmp/133_special_table_data.ans" @skip_for_gpdb_43 Scenario: 136 Backup and restore CAST, with associated function in restored schema, base_file_name=dump_func_name diff --git a/gpMgmt/test/behave/mgmt_utils/backup_and_restore_restores.feature b/gpMgmt/test/behave/mgmt_utils/backup_and_restore_restores.feature index 2e8b8d9d1798a4e0c0b2170b6eeb5a6dc4075b27..f2e1bbc618020e4a18a2490ef1721060be94b1a7 100644 --- a/gpMgmt/test/behave/mgmt_utils/backup_and_restore_restores.feature +++ b/gpMgmt/test/behave/mgmt_utils/backup_and_restore_restores.feature @@ -1098,147 +1098,139 @@ Feature: Validate command line arguments Scenario: 120 Simple full backup and restore with special character Given the old timestamps are read from json + And the backup test is initialized for special characters When the user runs gpdbrestore -e with the stored timestamp Then gpdbrestore should return a return code of 0 - And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/special_table_data.out" - And the user runs command "dropdb " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql "$SP_CHAR_DB" > /tmp/special_table_data.out" + And the user runs command "dropdb "$SP_CHAR_DB"" Scenario: 121 gpcrondump with -T option where table name, schema name and database name contains special character Given the old timestamps are read from json + And the backup test is initialized for special characters When the user runs gpdbrestore -e with the stored timestamp Then gpdbrestore should return a return code of 0 - And verify with backedup file "121_ao" that there is a "ao" table " S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . ao_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " with data - And verify with backedup file "121_heap" that there is a "heap" table " S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . heap_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " with data - And verify that there is no table " co_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " - And the user runs command "dropdb " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + And verify with backedup file "121_ao" that there is a "ao" table "$SP_CHAR_SCHEMA.$SP_CHAR_AO" in "$SP_CHAR_DB" with data + And verify with backedup file "121_heap" that there is a "heap" table "$SP_CHAR_SCHEMA.$SP_CHAR_HEAP" in "$SP_CHAR_DB" with data + And verify that there is no table "$SP_CHAR_CO" in "$SP_CHAR_DB" + And the user runs command "dropdb "$SP_CHAR_DB"" Scenario: 122 gpcrondump with --exclude-table-file option where table name, schema name and database name contains special character Given the old timestamps are read from json - Given the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_database.sql template1" + And the backup test is initialized for special characters + And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_database.sql template1" And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_schema.sql template1" When the user runs gpdbrestore -e with the stored timestamp Then gpdbrestore should return a return code of 0 - And verify with backedup file "122_ao" that there is a "ao" table " S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . ao_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " with data - And verify with backedup file "122_heap" that there is a "heap" table " S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . heap_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " with data - And verify that there is no table " co_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " - And the user runs command "dropdb " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + And verify with backedup file "122_ao" that there is a "ao" table "$SP_CHAR_SCHEMA.$SP_CHAR_AO" in "$SP_CHAR_DB" with data + And verify with backedup file "122_heap" that there is a "heap" table "$SP_CHAR_SCHEMA.$SP_CHAR_HEAP" in "$SP_CHAR_DB" with data + And verify that there is no table "$SP_CHAR_CO" in "$SP_CHAR_DB" + And the user runs command "dropdb "$SP_CHAR_DB"" Scenario: 123 gpcrondump with --table-file option where table name, schema name and database name contains special character Given the old timestamps are read from json - Given the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_database.sql template1" + And the backup test is initialized for special characters + And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_database.sql template1" And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_schema.sql template1" When the user runs gpdbrestore without -e with the stored timestamp and options " " Then gpdbrestore should return a return code of 0 - And verify with backedup file "123_ao" that there is a "ao" table " S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . ao_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " with data - And verify with backedup file "123_heap" that there is a "heap" table " S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . heap_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " with data - And verify that there is no table " co_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " - And the user runs command "dropdb " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + And verify with backedup file "123_ao" that there is a "ao" table "$SP_CHAR_SCHEMA.$SP_CHAR_AO" in "$SP_CHAR_DB" with data + And verify with backedup file "123_heap" that there is a "heap" table "$SP_CHAR_SCHEMA.$SP_CHAR_HEAP" in "$SP_CHAR_DB" with data + And verify that there is no table "$SP_CHAR_CO" in "$SP_CHAR_DB" + And the user runs command "dropdb "$SP_CHAR_DB"" Scenario: 124 gpcrondump with -t option where table name, schema name and database name contains special character Given the old timestamps are read from json - Given the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_database.sql template1" + And the backup test is initialized for special characters + And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_database.sql template1" And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_schema.sql template1" When the user runs gpdbrestore without -e with the stored timestamp and options " " Then gpdbrestore should return a return code of 0 - And verify with backedup file "124_ao" that there is a "ao" table " S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . ao_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " with data - And verify that there is no table " co_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " - And the user runs command "dropdb " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + And verify with backedup file "124_ao" that there is a "ao" table "$SP_CHAR_SCHEMA.$SP_CHAR_AO" in "$SP_CHAR_DB" with data + And verify that there is no table "$SP_CHAR_CO" in "$SP_CHAR_DB" + And the user runs command "dropdb "$SP_CHAR_DB"" Scenario: 125 gpcrondump with --schema-file option when schema name and database name contains special character Given the old timestamps are read from json + And the backup test is initialized for special characters When the user runs gpdbrestore -e with the stored timestamp - And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/special_table_data.out" + And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql "$SP_CHAR_DB" > /tmp/special_table_data.out" And verify that the contents of the files "/tmp/special_table_data.out" and "/tmp/125_special_table_data.ans" are identical - When the user runs command "dropdb " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + When the user runs command "dropdb "$SP_CHAR_DB"" Scenario: 126 gpcrondump with -s option when schema name and database name contains special character Given the old timestamps are read from json + And the backup test is initialized for special characters When the user runs gpdbrestore -e with the stored timestamp - And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/special_table_data.out" + And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql "$SP_CHAR_DB" > /tmp/special_table_data.out" And verify that the contents of the files "/tmp/special_table_data.out" and "/tmp/126_special_table_data.ans" are identical - When the user runs command "dropdb " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + When the user runs command "dropdb "$SP_CHAR_DB"" Scenario: 127 gpcrondump with --exclude-schema-file option when schema name and database name contains special character Given the old timestamps are read from json + And the backup test is initialized for special characters When the user runs gpdbrestore -e with the stored timestamp - Then verify that there is no table " ao_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " - And verify that there is no table " co_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " - And verify that there is no table " heap_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " - When the user runs command "dropdb " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + Then verify that there is no table "$SP_CHAR_AO" in "$SP_CHAR_DB" + And verify that there is no table "$SP_CHAR_CO" in "$SP_CHAR_DB" + And verify that there is no table "$SP_CHAR_HEAP" in "$SP_CHAR_DB" + When the user runs command "dropdb "$SP_CHAR_DB"" Scenario: 128 gpcrondump with -S option when schema name and database name contains special character Given the old timestamps are read from json + And the backup test is initialized for special characters When the user runs gpdbrestore -e with the stored timestamp - Then verify that there is no table " ao_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " - And verify that there is no table " co_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " - And verify that there is no table " heap_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " - When the user runs command "dropdb " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" - - Scenario: 129 Gpdbrestore with --table-file option when table name, schema name and database name contains special character - Given the old timestamps are read from json - When the user runs gpdbrestore -e with the stored timestamp and options "--table-file test/behave/mgmt_utils/steps/data/special_chars/table-file.txt" - Then gpdbrestore should return a return code of 0 - And verify with backedup file "129_ao" that there is a "ao" table " S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . ao_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " with data - And verify with backedup file "129_heap" that there is a "heap" table " S`~@#$%^&*()-+[{]}|\;: \'"/?><1 . heap_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " with data - And verify that there is no table " co_T`~@#$%^&*()-+[{]}|\;: \'"/?><1 " in " DB`~@#$%^&*()_-+[{]}|\;: \'/?><;1 " + Then verify that there is no table "$SP_CHAR_AO" in "$SP_CHAR_DB" + And verify that there is no table "$SP_CHAR_CO" in "$SP_CHAR_DB" + And verify that there is no table "$SP_CHAR_HEAP" in "$SP_CHAR_DB" + When the user runs command "dropdb "$SP_CHAR_DB"" Scenario: 130 Gpdbrestore with -T, --truncate, and --change-schema options when table name, schema name and database name contains special character Given the old timestamps are read from json + And the backup test is initialized for special characters And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_database.sql template1" And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_schema.sql template1" And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/add_schema.sql template1" And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_table.sql template1" - When the user runs gpdbrestore without -e with the stored timestamp and options "-T " S\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 "." ao_T\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 " --change-schema=" S\`~@#\$%^&*()_-+[{]}|\\;: \\'\"/?><1 " -S " S\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><2 " " + When the user runs gpdbrestore without -e with the stored timestamp and options "-T "$SP_CHAR_SCHEMA"."$SP_CHAR_AO" --change-schema="$SP_CHAR_SCHEMA" -S "$SP_CHAR_SCHEMA2"" Then gpdbrestore should return a return code of 2 And gpcrondump should print "-S option cannot be used with --change-schema option" to stdout - When the user runs gpdbrestore without -e with the stored timestamp and options "-T " S\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 "." ao_T\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 " --change-schema=" S\`~@#\$%^&*()_-+[{]}|\\;: \\'\"/?><2 " --truncate" + When the user runs gpdbrestore without -e with the stored timestamp and options "-T "$SP_CHAR_SCHEMA"."$SP_CHAR_AO" --change-schema="$SP_CHAR_SCHEMA2" --truncate" Then gpdbrestore should return a return code of 0 - And the user runs command "psql -f psql -c """select * from \" S\`~@#\$%^&*()_-+[{]}|\\;: \\'\"\"/?><2 \".\" ao_T\`~@#\$%^&*()-+[{]}|\\;: \\'\"\"/?><1 \" order by 1""" -d " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/table_data.out" + And the user runs command "psql -f psql -c """select * from \"$SP_CHAR_SCHEMA2\".\"$SP_CHAR_AO\" order by 1""" -d "$SP_CHAR_DB" > /tmp/table_data.out" And verify that the contents of the files "/tmp/130_table_data.ans" and "/tmp/table_data.out" are identical - When the user runs gpdbrestore without -e with the stored timestamp and options "-T " S\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 "." ao_T\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 " --truncate" + When the user runs gpdbrestore without -e with the stored timestamp and options "-T "$SP_CHAR_SCHEMA"."$SP_CHAR_AO" --truncate" Then gpdbrestore should return a return code of 0 - And the user runs command "psql -f psql -c """select * from \" S\`~@#\$%^&*()-+[{]}|\\;: \\'\"\"/?><1 \".\" ao_T\`~@#\$%^&*()-+[{]}|\\;: \\'\"\"/?><1 \" order by 1""" -d " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/table_data.out" + And the user runs command "psql -f psql -c """select * from \"$SP_CHAR_SCHEMA\".\"$SP_CHAR_AO\" order by 1""" -d "$SP_CHAR_DB" > /tmp/table_data.out" Then verify that the contents of the files "/tmp/130_table_data.ans" and "/tmp/table_data.out" are identical - When the user runs command "dropdb " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + When the user runs command "dropdb "$SP_CHAR_DB"" Scenario: 131 gpcrondump with --incremental option when table name, schema name and database name contains special character Given the old timestamps are read from json + And the backup test is initialized for special characters When the user runs gpdbrestore -e with the stored timestamp - And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/special_table_data.out" + And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql "$SP_CHAR_DB" > /tmp/special_table_data.out" Then verify that the contents of the files "/tmp/special_table_data.out" and "/tmp/131_special_table_data.ans" are identical - When the user runs command "dropdb " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 "" + When the user runs command "dropdb "$SP_CHAR_DB"" Scenario: 132 gpdbrestore with --redirect option with special db name, and all table name, schema name and database name contain special character Given the old timestamps are read from json + And the backup test is initialized for special characters When the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/drop_special_database.sql template1" - When the user runs gpdbrestore without -e with the stored timestamp and options "--redirect " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;2 "" - And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;2 " > /tmp/special_table_data.out" + When the user runs gpdbrestore without -e with the stored timestamp and options "--redirect "$SP_CHAR_DB"" + And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql "$SP_CHAR_DB" > /tmp/special_table_data.out" Then verify that the contents of the files "/tmp/special_table_data.out" and "/tmp/132_special_table_data.ans" are identical - When the user runs command "dropdb " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;2 "" + When the user runs command "dropdb "$SP_CHAR_DB"" Scenario: 133 gpdbrestore, -S option, -S truncate option schema level restore with special chars in schema name Given the old timestamps are read from json - When the user runs gpdbrestore -e with the stored timestamp and options "-S " S\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 "" - And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/special_table_data.out" + And the backup test is initialized for special characters + When the user runs gpdbrestore -e with the stored timestamp and options "-S "$SP_CHAR_SCHEMA"" + And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql "$SP_CHAR_DB" > /tmp/special_table_data.out" Then verify that the contents of the files "/tmp/special_table_data.out" and "/tmp/133_special_table_data.ans" are identical - When the user runs gpdbrestore without -e with the stored timestamp and options "-S " S\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 " --truncate" + When the user runs gpdbrestore without -e with the stored timestamp and options "-S "$SP_CHAR_SCHEMA" --truncate" Then gpdbrestore should return a return code of 0 - And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/special_table_data.out" + And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_table.sql "$SP_CHAR_DB" > /tmp/special_table_data.out" Then verify that the contents of the files "/tmp/special_table_data.out" and "/tmp/133_special_table_data.ans" are identical - Scenario: 134 gpdbrestore, --noplan option with special chars in database name, schema name, and table name - Given the old timestamps are read from json - And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/truncate_special_ao_table.sql template1" - When the user runs gpdbrestore without -e with the stored timestamp and options "--noplan" - And the user runs command "psql -f test/behave/mgmt_utils/steps/data/special_chars/select_from_special_ao_table.sql " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " > /tmp/special_ao_table_data.out" - Then verify that the contents of the files "/tmp/special_ao_table_data.out" and "/tmp/134_special_ao_table_data.ans" are identical - - Scenario: 135 Gpdbrestore, --change-schema option does not work with -S schema level restore option - Given the old timestamps are read from json - When the user runs gpdbrestore -e with the stored timestamp and options "-T " S\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 "." ao_T\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><1 " --change-schema=" S\`~@#\$%^&*()_-+[{]}|\\;: \\'\"/?><1 " -S " S\`~@#\$%^&*()-+[{]}|\\;: \\'\"/?><2 " " - Then gpdbrestore should return a return code of 2 - And gpdbrestore should print "-S option cannot be used with --change-schema option" to stdout - @skip_for_gpdb_43 Scenario: 136 Backup and restore CAST, with associated function in restored schema, base_file_name=dump_func_name Given the old timestamps are read from json diff --git a/gpMgmt/test/behave/mgmt_utils/backups.feature b/gpMgmt/test/behave/mgmt_utils/backups.feature index d5c64564e5446fc150063917007011e8cd1a8a1a..3375b21a1a873b0e4940e256a57cc32338e8b351 100644 --- a/gpMgmt/test/behave/mgmt_utils/backups.feature +++ b/gpMgmt/test/behave/mgmt_utils/backups.feature @@ -575,30 +575,29 @@ Feature: Validate command line arguments And gpcrondump should print "file is not formatted properly" to stdout And the mail_contacts file does not exist - Scenario: Gpcrondump, --table-file, --exclude-table-file, --schema-file and --exclude-schema-file if file contains double quoted table and schema name then gpcrondump should error out finding table does not exists + Scenario: If file contains double quoted table and schema name then gpcrondump should error out finding table does not exist Given the backup test is initialized with no backup files And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_database.sql template1" And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_schema.sql template1" And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_table.sql template1" # --table-file= option - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " --table-file test/behave/mgmt_utils/steps/data/special_chars/table-file-double-quote.txt" + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB" --table-file test/behave/mgmt_utils/steps/data/special_chars/table-file-double-quote.txt" Then gpcrondump should return a return code of 2 And gpcrondump should print "does not exist" to stdout # --exclude-table-file= option - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " --exclude-table-file test/behave/mgmt_utils/steps/data/special_chars/table-file-double-quote.txt" + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB" --exclude-table-file test/behave/mgmt_utils/steps/data/special_chars/table-file-double-quote.txt" Then gpcrondump should return a return code of 0 And gpcrondump should print "does not exist" to stdout And gpcrondump should print "All exclude table names have been removed due to issues" to stdout # --schema-file - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " --schema-file test/behave/mgmt_utils/steps/data/special_chars/schema-file-double-quote.txt" + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB" --schema-file test/behave/mgmt_utils/steps/data/special_chars/schema-file-double-quote.txt" Then gpcrondump should return a return code of 2 And gpcrondump should print "does not exist" to stdout # --exclude-schema-file - When the user runs command "gpcrondump -a -x " DB\`~@#\$%^&*()_-+[{]}|\\;: \\'/?><;1 " --exclude-schema-file test/behave/mgmt_utils/steps/data/special_chars/schema-file-double-quote.txt" + When the user runs command "gpcrondump -a -x "$SP_CHAR_DB" --exclude-schema-file test/behave/mgmt_utils/steps/data/special_chars/schema-file-double-quote.txt" Then gpcrondump should return a return code of 0 And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/drop_special_database.sql template1" - Scenario: Absolute path should be provided with -u option for gpcrondump Given the backup test is initialized with no backup files And there is a "heap" table "heap_table" in "bkdb" with data diff --git a/gpMgmt/test/behave/mgmt_utils/restores.feature b/gpMgmt/test/behave/mgmt_utils/restores.feature index 9f7e8924231b86e181cc879ddfe09d406398b8a7..79768186594002820f8fea950e50da0c75065271 100644 --- a/gpMgmt/test/behave/mgmt_utils/restores.feature +++ b/gpMgmt/test/behave/mgmt_utils/restores.feature @@ -7,11 +7,6 @@ Feature: Validate command line arguments Then gpdbrestore should return a return code of 2 And gpdbrestore should print "Cannot specify --list-backup and -e together" to stdout - Scenario: gpdbrestore, -s option with special chars - Given the backup test is initialized with no backup files - When the user runs command "gpdbrestore -s " DB\`~@#\$%^&*()_-+[{]}|\\;:.;\n\t \\'/?><;2 "" - Then gpdbrestore should print "Name has an invalid character" to stdout - Scenario: Funny characters in the table name or schema name for gpdbrestore Given the backup test is initialized with no backup files And database "testdb" exists diff --git a/gpMgmt/test/behave/mgmt_utils/steps/backup_mgmt_utils.py b/gpMgmt/test/behave/mgmt_utils/steps/backup_mgmt_utils.py index bc447c2feaee5e85bcbea9d8384fadcbb3f0d7e0..487cc857db85de9f0d8f7bb751e8fe4679e4cd74 100644 --- a/gpMgmt/test/behave/mgmt_utils/steps/backup_mgmt_utils.py +++ b/gpMgmt/test/behave/mgmt_utils/steps/backup_mgmt_utils.py @@ -412,12 +412,17 @@ def impl(context, role_name, dbname): def impl(context, filenames, table_list, dbname): files = [f for f in filenames.split(',')] tables = [t for t in table_list.split(',')] + dbname = replace_special_char_env(dbname) for t,f in zip(tables,files): + t = replace_special_char_env(t) + f = replace_special_char_env(f) backup_data_to_file(context, t, dbname, f) @when('verify with backedup file "{filename}" that there is a "{table_type}" table "{tablename}" in "{dbname}" with data') @then('verify with backedup file "{filename}" that there is a "{table_type}" table "{tablename}" in "{dbname}" with data') def impl(context, filename, table_type, tablename, dbname): + dbname = replace_special_char_env(dbname) + tablename = replace_special_char_env(tablename) if not check_table_exists(context, dbname=dbname, table_name=tablename, table_type=table_type): raise Exception("Table '%s' does not exist when it should" % tablename) validate_restore_data_in_file(context, tablename, dbname, filename) diff --git a/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py b/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py index e97f42d5cee3b421ff7d8d5d91b35dfb2a6d8192..385bd3068c925840668f09d058710891e522f3c3 100644 --- a/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py +++ b/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py @@ -1088,6 +1088,8 @@ def impl(context, options): @then('verify that there is no table "{tablename}" in "{dbname}"') def impl(context, tablename, dbname): + dbname = replace_special_char_env(dbname) + tablename = replace_special_char_env(tablename) if check_table_exists(context, dbname=dbname, table_name=tablename): raise Exception("Table '%s' still exists when it should not" % tablename) @@ -4404,6 +4406,12 @@ def impl(context, dbname): @given('the backup test is initialized for special characters') def impl(context): + os.environ["SP_CHAR_DB"] = """ DB`~@#$%^&*()_-+[{]}|\;: \\'/?><;1 """ + os.environ["SP_CHAR_SCHEMA"] = """ S`~@#$%^&*()-+[{]}|\;: \\'"/?><1 """ + os.environ["SP_CHAR_SCHEMA2"] = """ S`~@#$%^&*()_-+[{]}|\;: \\'"/?><2 """ + os.environ["SP_CHAR_HEAP"] = """ heap_T`~@#$%^&*()-+[{]}|\;: \\'"/?><1 """ + os.environ["SP_CHAR_AO"] = """ ao_T`~@#$%^&*()-+[{]}|\;: \\'"/?><1 """ + os.environ["SP_CHAR_CO"] = """ co_T`~@#$%^&*()-+[{]}|\;: \\'"/?><1 """ context.execute_steps(u''' Given the database is running And the user runs "psql -f test/behave/mgmt_utils/steps/data/special_chars/create_special_database.sql template1" diff --git a/gpMgmt/test/behave_utils/utils.py b/gpMgmt/test/behave_utils/utils.py index 781067327875037c53aee037c30486620c17a083..dfd4afa03a94ba2471a3d781b6ad5ed3affd6f0e 100644 --- a/gpMgmt/test/behave_utils/utils.py +++ b/gpMgmt/test/behave_utils/utils.py @@ -1651,3 +1651,10 @@ def is_process_running(proc_name): def file_contains_line(filepath, target_line): with open(filepath, 'r') as myfile: return target_line in myfile.read().splitlines() + +def replace_special_char_env(str): + for var in ["SP_CHAR_DB", "SP_CHAR_SCHEMA", "SP_CHAR_AO", "SP_CHAR_CO", "SP_CHAR_HEAP"]: + if var in os.environ: + str = str.replace("$%s" % var, os.environ[var]) + return str +