This is an automated email from the ASF dual-hosted git repository. avamingli pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit d54296dcae2d864414bb0325124bb9b661f081d1 Author: Jimmy Yih <[email protected]> AuthorDate: Mon Sep 12 16:42:02 2022 -0700 Fix gpinitsystem Behave tests that use environment variables Currently, the gpinitsystem Behave tests fail because of environment variables being set in the tests not being unset/reset. Subsequent tests after an environment variable is set are affected and could fail if related (e.g. the locale tests). It didn't help that our Behave steps relating to environment variables were not working cohesively as well. The step to set the environment variable was not storing the original into the context for the other two steps to use. The step to unset the environment variable was not being used properly in our Behave tests because the step format did not have double quotes whereas all step references were double-quoting the environment variable. The previously unused step to restore the environment variable did not properly check for None values and would have also been confused with the double quotes if used. Fix the gpinitsystem Behave tests by fixing the mgmt_utils steps relating to environment variables and make sure to unset environment variables at the end of relevant Behave tests. --- gpMgmt/test/behave/mgmt_utils/gpinitsystem.feature | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gpMgmt/test/behave/mgmt_utils/gpinitsystem.feature b/gpMgmt/test/behave/mgmt_utils/gpinitsystem.feature index becd82533b..1eb8a65d9c 100644 --- a/gpMgmt/test/behave/mgmt_utils/gpinitsystem.feature +++ b/gpMgmt/test/behave/mgmt_utils/gpinitsystem.feature @@ -24,6 +24,7 @@ Feature: gpinitsystem tests Then gpinitsystem should return a return code of 0 Given the user runs "gpstate" Then gpstate should return a return code of 0 + And "LC_ALL" environment variable should be restored Scenario: gpinitsystem creates a cluster when the user set -n or --locale parameter Given create demo cluster config @@ -39,6 +40,7 @@ Feature: gpinitsystem tests Then gpinitsystem should return a return code of 0 Given the user runs "gpstate" Then gpstate should return a return code of 0 + And "LC_MONETARY" environment variable should be restored Scenario: gpinitsystem exits with status 0 when the user set locale parameters Given create demo cluster config @@ -213,6 +215,7 @@ Feature: gpinitsystem tests And the database timezone matches "HST" And the startup timezone is saved And the startup timezone matches "HST" + And "TZ" environment variable should be restored Scenario: gpinitsystem should print FQDN in pg_hba.conf when HBA_HOSTNAMES=1 Given the cluster config is generated with HBA_HOSTNAMES "1" @@ -284,6 +287,8 @@ Feature: gpinitsystem tests And the database locales "lc_collate" match the locale "C" And the database locales "lc_ctype" match the installed UTF locale And the database locales "lc_messages,lc_monetary,lc_numeric,lc_time" match the system locale + And "LC_COLLATE" environment variable should be restored + And "LC_CTYPE" environment variable should be restored @backup_restore_bashrc Scenario: gpinitsystem succeeds if there is banner on host --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
