This is an automated email from the ASF dual-hosted git repository. maxyang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit ed8778b318bc97e0b53f3fb74a985c338e0099fa Author: Dev Swaroop Chattopadhyay <[email protected]> AuthorDate: Tue Jul 19 15:35:57 2022 +0530 gpcheckcat needs to reset GV.retcode before starting to check a database (#13735) * Reset GV.retcode before running test for each database using gpcheckcat Previously while running gpcheckcat, if the check fails on one database then the value of GV.retcode was not reset before running the checks on the next database in the list.Due to this a check failed on one database was causing a AssertionError for the next database in the list which passes. With this PR added a change for resetting the value of GV.retcode after each database check. --- gpMgmt/bin/gpcheckcat | 8 +++++++- gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gpMgmt/bin/gpcheckcat b/gpMgmt/bin/gpcheckcat index 4150acbae4..8237606a37 100755 --- a/gpMgmt/bin/gpcheckcat +++ b/gpMgmt/bin/gpcheckcat @@ -97,6 +97,9 @@ def setError(level): ''' GV.retcode = max(level, GV.retcode) +def setScriptRetCode(level): + GV.script_retcode = max(level,GV.script_retcode) + ############################### class Global(): @@ -148,6 +151,7 @@ class Global(): self.catalog = None self.max_content = 0 self.report_cfg = {} + self.script_retcode = SUCCESS def reset_stmt_queues(self): @@ -3382,6 +3386,7 @@ def main(): for dbname in GV.alldb: # Reset global variables + GV.retcode=SUCCESS GV.reset_stmt_queues() GPObjects.clear() GPObjectGraph.clear() @@ -3418,12 +3423,13 @@ def main(): runAllChecks(run_tests) checkcatReport() + setScriptRetCode(GV.retcode) # skip shared tables on subsequent passes if not GV.opt['-S']: GV.opt['-S'] = "none" - sys.exit(GV.retcode) + sys.exit(GV.script_retcode) ############# if __name__ == '__main__': diff --git a/gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature b/gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature index a8d4c37798..42ca7cf485 100644 --- a/gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature +++ b/gpMgmt/test/behave/mgmt_utils/gpcheckcat.feature @@ -553,6 +553,13 @@ Feature: gpcheckcat tests And validate gpcheckcat logs contain skipping ACL and Owner tests And the user runs "dropdb all_good" + Scenario: gpcheckcat should return 3 if catalog issue is found on one database but the next database in the list has no catalog issue + Given database "mis_attr_db" is dropped and recreated + And the user runs "psql -d mis_attr_db -c "set allow_system_table_mods=true;DELETE FROM pg_class WHERE relname='gp_fastsequence';"" + Then psql should return a return code of 0 + Then the user runs "gpcheckcat -A" + Then gpcheckcat should return a return code of 3 + And the user runs "dropdb mis_attr_db" ########################### @concourse_cluster tests ########################### # The @concourse_cluster tag denotes the scenario that requires a remote cluster --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
