Esempio n. 1
0
    def test_run_sql_command_catalog_update(self):
        sql_cmd = 'show gp_session_role;'
        out_file = os.path.join(os.path.dirname(inspect.getfile(self.__class__)),'test_catalog_update.out')
        self.assertFalse(os.path.exists(out_file))
        try:
            PSQL.run_sql_command_catalog_update(sql_cmd = sql_cmd, out_file = out_file)
            self.assertTrue(os.path.exists(out_file))
            with open(out_file, 'r') as f:
                output = f.read()
                self.assertIsNotNone(re.search('utility', output))
        finally:
            os.remove(out_file)
            self.assertFalse(os.path.exists(out_file))

        sql_cmd = 'show allow_system_table_mods;'
        out_file = os.path.join(os.path.dirname(inspect.getfile(self.__class__)),'test_catalog_update.out')
        self.assertFalse(os.path.exists(out_file))
        try:
            PSQL.run_sql_command_catalog_update(sql_cmd = sql_cmd, out_file = out_file)
            self.assertTrue(os.path.exists(out_file))
            with open(out_file, 'r') as f:
                output = f.read()
                self.assertIsNotNone(re.search('DML', output))
        finally:
            os.remove(out_file)
            self.assertFalse(os.path.exists(out_file))
Esempio n. 2
0
    def test_run_sql_command_catalog_update(self):
        sql_cmd = 'show gp_session_role;'
        out_file = os.path.join(
            os.path.dirname(inspect.getfile(self.__class__)),
            'test_catalog_update.out')
        self.assertFalse(os.path.exists(out_file))
        try:
            PSQL.run_sql_command_catalog_update(sql_cmd=sql_cmd,
                                                out_file=out_file)
            self.assertTrue(os.path.exists(out_file))
            with open(out_file, 'r') as f:
                output = f.read()
                self.assertIsNotNone(re.search('utility', output))
        finally:
            os.remove(out_file)
            self.assertFalse(os.path.exists(out_file))

        sql_cmd = 'show allow_system_table_mods;'
        out_file = os.path.join(
            os.path.dirname(inspect.getfile(self.__class__)),
            'test_catalog_update.out')
        self.assertFalse(os.path.exists(out_file))
        try:
            PSQL.run_sql_command_catalog_update(sql_cmd=sql_cmd,
                                                out_file=out_file)
            self.assertTrue(os.path.exists(out_file))
            with open(out_file, 'r') as f:
                output = f.read()
                self.assertIsNotNone(re.search('DML', output))
        finally:
            os.remove(out_file)
            self.assertFalse(os.path.exists(out_file))
Esempio n. 3
0
    def test_run_sql_command_catalog_update_with_additional_pgoptions(self):
        sql_cmd = "show gp_session_role;"
        output = PSQL.run_sql_command_catalog_update(sql_cmd=sql_cmd)
        self.assertIsNotNone(re.search("utility", output))

        sql_cmd = "show allow_system_table_mods;"
        output = PSQL.run_sql_command_catalog_update(sql_cmd=sql_cmd)
        self.assertIsNotNone(re.search("DML", output))

        sql_cmd = "show client_min_messages;"
        output = PSQL.run_sql_command_catalog_update(sql_cmd=sql_cmd, PGOPTIONS="-c client_min_messages=log")
        self.assertIsNotNone(re.search("log", output))
Esempio n. 4
0
    def test_run_sql_command_catalog_update_with_additional_pgoptions(self):
        sql_cmd = 'show gp_session_role;'
        output = PSQL.run_sql_command_catalog_update(sql_cmd=sql_cmd)
        self.assertIsNotNone(re.search('utility', output))

        sql_cmd = 'show allow_system_table_mods;'
        output = PSQL.run_sql_command_catalog_update(sql_cmd=sql_cmd)
        self.assertIsNotNone(re.search('DML', output))

        sql_cmd = 'show client_min_messages;'
        output = PSQL.run_sql_command_catalog_update(
            sql_cmd=sql_cmd, PGOPTIONS="-c client_min_messages=log")
        self.assertIsNotNone(re.search('log', output))