提交 86ed42f7 编写于 作者: C Christopher Hajas 提交者: Karen Huddleston

Unify backup_43_restore_5 and backup.feature test suites

上级 4697811d
因为 它太大了无法显示 source diff 。你可以改为 查看blob
此差异已折叠。
@restores
Feature: Validate command line arguments
Scenario: gpdbrestore list_backup option with -e
Given the backup test is initialized
And there are no backup files
When the user runs "gpdbrestore -a -e --list-backup -t 20160101010101"
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
And there are 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
And there are no backup files
And database "testdb" exists
And there is a "heap" table "public.table1" in "testdb" with data
When the user runs command "gpcrondump -a -x testdb"
And the timestamp from gpcrondump is stored
When the user runs gpdbrestore with the stored timestamp and options "--table-file test/behave/mgmt_utils/steps/data/special_chars/funny_char_table.txt"
Then gpdbrestore should return a return code of 2
And gpdbrestore should print Name has an invalid character to stdout
When the user runs gpdbrestore with the stored timestamp and options "-T pub\\t\\nlic.!,\\t\\n.1"
Then gpdbrestore should return a return code of 2
And gpdbrestore should print Name has an invalid character to stdout
When the user runs gpdbrestore with the stored timestamp and options "--redirect A\\t\\n.,!1"
Then gpdbrestore should return a return code of 2
And gpdbrestore should print Name has an invalid character to stdout
When the user runs command "gpdbrestore -s "A\\t\\n.,!1""
Then gpdbrestore should return a return code of 2
And gpdbrestore should print Name has an invalid character to stdout
When the user runs gpdbrestore with the stored timestamp and options "-T public.table1 --change-schema A\\t\\n.,!1"
Then gpdbrestore should return a return code of 2
And gpdbrestore should print Name has an invalid character to stdout
When the user runs gpdbrestore with the stored timestamp and options "-S A\\t\\n.,!1"
Then gpdbrestore should return a return code of 2
And gpdbrestore should print Name has an invalid character to stdout
Scenario: gpdbrestore -b with Full timestamp
Given the backup test is initialized
And there are no backup files
And there is a "ao" table "public.ao_index_table" in "bkdb" with data
When the user runs "gpcrondump -a -x bkdb"
Then gpcrondump should return a return code of 0
And the subdir from gpcrondump is stored
And the full backup timestamp from gpcrondump is stored
And the timestamp from gpcrondump is stored
And the user runs gpdbrestore with the stored timestamp and options "-b"
Then gpdbrestore should return a return code of 0
Scenario: Output info gpdbrestore
Given the backup test is initialized
And there are no backup files
And there is a "ao" table "public.ao_index_table" in "bkdb" with data
When the user runs "gpcrondump -a -x bkdb"
Then gpcrondump should return a return code of 0
And the timestamp from gpcrondump is stored
When the user runs gpdbrestore with the stored timestamp
Then gpdbrestore should return a return code of 0
And gpdbrestore should print Restore type = Full Database to stdout
When the user runs "gpdbrestore -T public.ao_index_table -a" with the stored timestamp
Then gpdbrestore should return a return code of 0
And gpdbrestore should print Restore type = Table Restore to stdout
And table "public.ao_index_table" is assumed to be in dirty state in "bkdb"
When the user runs "gpcrondump -a -x bkdb --incremental"
Then gpcrondump should return a return code of 0
And the timestamp from gpcrondump is stored
When the user runs gpdbrestore with the stored timestamp
Then gpdbrestore should return a return code of 0
And gpdbrestore should print Restore type = Incremental Restore to stdout
When the user runs "gpdbrestore -T public.ao_index_table -a" with the stored timestamp
Then gpdbrestore should return a return code of 0
And gpdbrestore should print Restore type = Incremental Table Restore to stdout
......@@ -141,12 +141,6 @@ def impl(context, backup_pg, dbname):
if row_count != 0:
raise Exception("Found a ExclusiveLock on pg_class")
@given('there is a "{tabletype}" table "{table_name}" with compression "{compression_type}" in "{dbname}" with data and {rowcount} rows')
@when('there is a "{tabletype}" table "{table_name}" with compression "{compression_type}" in "{dbname}" with data and {rowcount} rows')
@then('there is a "{tabletype}" table "{table_name}" with compression "{compression_type}" in "{dbname}" with data and {rowcount} rows')
def impl(context, tabletype, table_name, compression_type, dbname, rowcount):
populate_regular_table_data(context, tabletype, table_name, compression_type, dbname, int(rowcount))
@given('verify the metadata dump file syntax under "{directory}" for comments and types')
@when('verify the metadata dump file syntax under "{directory}" for comments and types')
@then('verify the metadata dump file syntax under "{directory}" for comments and types')
......
\c bkdb dsp_role
Create table role_guc_table (i int, j int);
Insert into role_guc_table select i, i+1 from generate_series(1,10) i;
\ No newline at end of file
Insert into role_guc_table select i, i+1 from generate_series(1,10) i;
......@@ -1114,8 +1114,9 @@ def impl(context, path):
if context.exception:
raise context.exception
@when('there are no backup files')
@given('there are no backup files')
@then('there are no backup files')
@when('there are no backup files')
def impl(context):
cleanup_backup_files(context, 'template1')
......@@ -1788,10 +1789,10 @@ def validate_segment_config_backup_files(context, dir=None):
seg_data_dir = dir if dir is not None else ps.getSegmentDataDirectory()
dump_dir = os.path.join(seg_data_dir, 'db_dumps', context.backup_timestamp[0:8])
dump_files = ListRemoteFilesByPattern(dump_dir,
'%sgp_segment_config_files_*_%d_*.tar' % (context.dump_prefix, ps.getSegmentDbId()),
'%sgp_segment_config_files_*_%d_%s.tar' % (context.dump_prefix, ps.getSegmentDbId(), context.backup_timestamp),
ps.getSegmentHostName()).run()
if len(dump_files) != 1:
raise Exception('Error in finding config files "%s" for segment %s' % (dump_files, seg_data_dir))
raise Exception('Found too many config files for segment %s: %s' % (dump_files, seg_data_dir))
@then('config files should be backed up on all segments')
def impl(context):
......@@ -2148,6 +2149,13 @@ def impl(context, dirname):
if not os.path.isdir(dirname):
raise Exception("directory '%s' not created" % dirname)
@then('the directory "{dirname}" does not exist')
def impl(context, dirname):
if os.path.isdir(dirname):
shutil.rmtree(dirname, ignore_errors=True)
if os.path.isdir(dirname):
raise Exception("directory '%s' not removed" % dirname)
@given('the directory "{dirname}" exists in current working directory')
def impl(context, dirname):
dirname = os.path.join(os.getcwd(), dirname)
......@@ -3911,23 +3919,21 @@ def execute_sql_until_stopped(context, dbname, query):
def impl(context):
context.background_query_lock = True
@given('the test is initialized')
@given('the backup test is initialized')
def impl(context):
context.execute_steps(u'''
Given the database is running
And database "bkdb" is dropped and recreated
And there are no backup files
And the backup files in "/tmp" are deleted
''')
@given('the test is initialized with database "{dbname}"')
@given('the backup test is initialized with database "{dbname}"')
def impl(context, dbname):
context.execute_steps(u'''
Given the database is running
And database "%s" is dropped and recreated
''' % dbname)
@given('the test is initialized for special characters')
@given('the backup test is initialized for special characters')
def impl(context):
context.execute_steps(u'''
Given the database is running
......@@ -3952,6 +3958,12 @@ def impl(context):
def impl(context, tabletype, tablename, dbname):
populate_regular_table_data(context, tabletype, tablename, 'None', dbname, with_data=True)
@given('there is a "{tabletype}" table "{table_name}" with compression "{compression_type}" in "{dbname}" with data and {rowcount} rows')
@when('there is a "{tabletype}" table "{table_name}" with compression "{compression_type}" in "{dbname}" with data and {rowcount} rows')
@then('there is a "{tabletype}" table "{table_name}" with compression "{compression_type}" in "{dbname}" with data and {rowcount} rows')
def impl(context, tabletype, table_name, compression_type, dbname, rowcount):
populate_regular_table_data(context, tabletype, table_name, compression_type, dbname, int(rowcount))
@given('there is a "{tabletype}" partition table "{table_name}" in "{dbname}" with data')
@then('there is a "{tabletype}" partition table "{table_name}" in "{dbname}" with data')
@when('there is a "{tabletype}" partition table "{table_name}" in "{dbname}" with data')
......@@ -4245,3 +4257,4 @@ def store_timestamp_in_old_format(context, directory = None, prefix = ""):
@when('the timestamp will be stored in json format')
def impl(context):
context.is_timestamp_stored_as_json = True
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册