From c52c768edf022217947ed3439a927d8fa971ee23 Mon Sep 17 00:00:00 2001 From: Marbin Tan Date: Fri, 12 May 2017 17:23:16 -0700 Subject: [PATCH] gpperfmon: gpperfmon_install should include IPv6 localhost If IPv6 is enabled, gpperfmon will complain that it can't connect to the database because, gpmon does not have permission to access through ::1. - Add behave test --- gpAux/gpperfmon/src/gpmon/gpperfmon_install | 3 +++ gpMgmt/test/behave/mgmt_utils/gpperfmon.feature | 3 ++- gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py | 10 +++++----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gpAux/gpperfmon/src/gpmon/gpperfmon_install b/gpAux/gpperfmon/src/gpmon/gpperfmon_install index cafac4d5e9..908ed49cb0 100755 --- a/gpAux/gpperfmon/src/gpmon/gpperfmon_install +++ b/gpAux/gpperfmon/src/gpmon/gpperfmon_install @@ -166,6 +166,9 @@ if __name__ == '__main__': cmd = Command("""echo "host all gpmon 127.0.0.1/28 md5" >> %s""" % pg_hba, showOutput=True) commands.append(cmd) + cmd = Command("""echo "host all gpmon ::1/128 md5" >> %s""" % pg_hba, showOutput=True) + commands.append(cmd) + ################################################ # these commands add a new line to the top of .pgpass and save a copy of old .pgpass cmd = Command("""touch %s""" % (pg_pass)) diff --git a/gpMgmt/test/behave/mgmt_utils/gpperfmon.feature b/gpMgmt/test/behave/mgmt_utils/gpperfmon.feature index b6beae057a..4582febb36 100644 --- a/gpMgmt/test/behave/mgmt_utils/gpperfmon.feature +++ b/gpMgmt/test/behave/mgmt_utils/gpperfmon.feature @@ -17,7 +17,8 @@ Feature: gpperfmon Given the database "gpperfmon" does not exist When the user runs "gpperfmon_install --port 15432 --enable --password foo" Then gpperfmon_install should return a return code of 0 - Then verify that the last line of the master postgres configuration file contains the string "gpperfmon_log_alert_level=warning" + Then verify that the last line of the file "postgresql.conf" in the master data directory contains the string "gpperfmon_log_alert_level=warning" + Then verify that the last line of the file "pg_hba.conf" in the master data directory contains the string "host all gpmon ::1/128 md5" And verify that there is a "heap" table "database_history" in "gpperfmon" @gpperfmon_run diff --git a/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py b/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py index 385bd3068c..fc5f504df8 100644 --- a/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py +++ b/gpMgmt/test/behave/mgmt_utils/steps/mgmt_utils.py @@ -4213,11 +4213,11 @@ def impl(context, filename, output): check_stdout_msg(context, output) -@then('verify that the last line of the master postgres configuration file contains the string "{output}"') -def impl(context, output): +@then('verify that the last line of the file "{filename}" in the master data directory contains the string "{output}"') +def impl(context, filename, output): contents = '' - filename = master_data_dir + "/postgresql.conf" - with open(filename) as fr: + file_path = os.path.join(master_data_dir, filename) + with open(file_path) as fr: for line in fr: contents = line.strip() pat = re.compile(output) @@ -4883,7 +4883,7 @@ def impl(context): When the user runs "gpstart -a" Then gpstart should return a return code of 0 And verify that a role "gpmon" exists in database "gpperfmon" - And verify that the last line of the master postgres configuration file contains the string "gpperfmon_log_alert_level=warning" + And verify that the last line of the file "postgresql.conf" in the master data directory contains the string "gpperfmon_log_alert_level=warning" And verify that there is a "heap" table "database_history" in "gpperfmon" Then wait until the process "gpmmon" is up And wait until the process "gpsmon" is up -- GitLab