提交 5dc8f90e 编写于 作者: J Jimmy Yih 提交者: Jamie McAtamney

Change method of gptransfer verification.

Changed gptransfer verification step in Behave to check the
return code instead of whether gpdiff prints any lines.  Also
removed an unnecessary print statement in gpdiff and made
minor readability changes to the Behave step.

Authors: James McAtamney and Jimmy Yih
上级 e2316eb3
......@@ -1427,7 +1427,7 @@ Feature: gptransfer tests
And the user runs "gptransfer --full --source-port $GPTRANSFER_SOURCE_PORT --source-host $GPTRANSFER_SOURCE_HOST --source-user $GPTRANSFER_SOURCE_USER --dest-user $GPTRANSFER_DEST_USER --dest-port $GPTRANSFER_DEST_PORT --dest-host $GPTRANSFER_DEST_HOST --source-map-file $GPTRANSFER_MAP_FILE"
Then gptransfer should return a return code of 0
And psql should return a return code of 0
Then Verify data integrity of database "gptest" between source and destination system, work-dir "gppylib/test/behave/mgmt_utils/steps/data/gptransfer_verify"
Then verify data integrity of database "gptest" between source and destination system, work-dir "gppylib/test/behave/mgmt_utils/steps/data/gptransfer_verify"
And the user stops the gpfdist on host "GPTRANSFER_SOURCE_HOST" and port "2345" in work directory "HOME" from remote "2"
And the user runs "psql -p $GPTRANSFER_SOURCE_PORT -h $GPTRANSFER_SOURCE_HOST -U $GPTRANSFER_SOURCE_USER -f gppylib/test/behave/mgmt_utils/steps/data/gptransfer/teardown.sql -d template1"
And the user runs "psql -p $GPTRANSFER_DEST_PORT -h $GPTRANSFER_DEST_HOST -U $GPTRANSFER_DEST_USER -f gppylib/test/behave/mgmt_utils/steps/data/gptransfer/teardown.sql -d template1"
......
......@@ -645,31 +645,28 @@ def impl(context):
context.inc_backup_timestamps.append(context.backup_timestamp)
@then('Verify data integrity of database "{dbname}" between source and destination system, work-dir "{dir}"')
@then('verify data integrity of database "{dbname}" between source and destination system, work-dir "{dir}"')
def impl(context, dbname, dir):
dbconn_src = 'psql -p $GPTRANSFER_SOURCE_PORT -h $GPTRANSFER_SOURCE_HOST -U $GPTRANSFER_SOURCE_USER -d %s'%dbname
dbconn_dest = 'psql -p $GPTRANSFER_DEST_PORT -h $GPTRANSFER_DEST_HOST -U $GPTRANSFER_DEST_USER -d %s'%dbname
dbconn_src = 'psql -p $GPTRANSFER_SOURCE_PORT -h $GPTRANSFER_SOURCE_HOST -U $GPTRANSFER_SOURCE_USER -d %s' % dbname
dbconn_dest = 'psql -p $GPTRANSFER_DEST_PORT -h $GPTRANSFER_DEST_HOST -U $GPTRANSFER_DEST_USER -d %s' % dbname
for file in os.listdir(dir):
if file.endswith('.sql'):
filename_prefix = os.path.splitext(file)[0]
ans_file_path = os.path.join(dir,filename_prefix+'.ans')
out_file_path = os.path.join(dir,filename_prefix+'.out')
diff_file_path = os.path.join(dir,filename_prefix+'.diff')
ans_file_path = os.path.join(dir,filename_prefix + '.ans')
out_file_path = os.path.join(dir,filename_prefix + '.out')
diff_file_path = os.path.join(dir,filename_prefix + '.diff')
# run the command to get the exact data from the source system
command = '%s -f %s > %s'%(dbconn_src, os.path.join(dir,file), ans_file_path)
command = '%s -f %s > %s' % (dbconn_src, os.path.join(dir, file), ans_file_path)
run_command(context, command)
# run the command to get the data from the destination system, locally
command = '%s -f %s > %s'%(dbconn_dest, os.path.join(dir,file), out_file_path)
command = '%s -f %s > %s' % (dbconn_dest, os.path.join(dir, file), out_file_path)
run_command(context, command)
gpdiff_cmd = 'gpdiff.pl -w -I NOTICE: -I HINT: -I CONTEXT: -I GP_IGNORE: --gp_init_file=gppylib/test/behave/mgmt_utils/steps/data/global_init_file %s %s > %s'%(ans_file_path, out_file_path, diff_file_path)
gpdiff_cmd = 'gpdiff.pl -w -I NOTICE: -I HINT: -I CONTEXT: -I GP_IGNORE: --gp_init_file=gppylib/test/behave/mgmt_utils/steps/data/global_init_file %s %s > %s' % (ans_file_path, out_file_path, diff_file_path)
run_command(context, gpdiff_cmd)
for file in os.listdir(dir):
if file.endswith('.diff') and os.path.getsize(os.path.join(dir,file)) > 0:
# if there is some difference generated into the diff file, raise expception
raise Exception ("Found difference between source and destination system, see %s"%file)
if context.ret_code != 0:
raise Exception ("Found difference between source and destination system, see %s" % file)
@then('run post verifying workload under "{dir}"')
def impl(context, dir):
......
......@@ -190,9 +190,7 @@ sub gpdiff_files
{
atmsort::atmsort_init(%glob_atmsort_args);
atmsort::run($f1, $newf1);
print "$f1 - $newf1\n";
atmsort::run($f2, $newf2);
print "$f2 - $newf2\n";
}
my $args = join(" ", @ARGV, $newf1, $newf2);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册