• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python lib.Gpdiff类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tinctest.lib.Gpdiff的典型用法代码示例。如果您正苦于以下问题:Python Gpdiff类的具体用法?Python Gpdiff怎么用?Python Gpdiff使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Gpdiff类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_uao_crash_compaction_before_cleanup_phase_master_with_aocs

    def test_uao_crash_compaction_before_cleanup_phase_master_with_aocs(self):
        setup_file = self.get_sql_files("uao_crash_compaction_before_cleanup_phase_master_with_aocs_setup")[0]
        (sql_file1, out_file1,ans_file1) = self.get_sql_files("uao_crash_compaction_before_cleanup_phase_master_with_aocs1")
        (sql_file2, out_file2, ans_file2) = self.get_sql_files("uao_crash_compaction_before_cleanup_phase_master_with_aocs2")
        if not os.path.exists(os.path.dirname(out_file1)):
            os.mkdir(os.path.dirname(out_file1))
        set_fault_in_master_panic = 'source %s/greenplum_path.sh;gpfaultinjector -p %s -f compaction_before_cleanup_phase -y panic --seg_dbid 1'  % (os.getenv('GPHOME'), os.getenv('PGPORT'))
        set_fault_in_master_reset = 'source %s/greenplum_path.sh;gpfaultinjector -p %s -f compaction_before_cleanup_phase -y reset --seg_dbid 1'  % (os.getenv('GPHOME'), os.getenv('PGPORT'))
        cmd_type = 'fault injector'

        PSQL.run_sql_file(setup_file)
        gpfaultinjector = Command(cmd_type, set_fault_in_master_panic)

        gpfaultinjector.run()

        PSQL.run_sql_file(sql_file1, out_file=out_file1)
    
        result1 = Gpdiff.are_files_equal(out_file1, ans_file1, match_sub=[gpdiff_init_file])

        PSQL.wait_for_database_up();

        gpfaultinjector = Command(cmd_type, set_fault_in_master_reset)
        gpfaultinjector.run()

        PSQL.run_sql_file(sql_file2, out_file=out_file2)
        result2 = Gpdiff.are_files_equal(out_file2, ans_file2, match_sub=[gpdiff_init_file])

        self.assertTrue(result1)
        self.assertTrue(result2)
开发者ID:50wu,项目名称:gpdb,代码行数:29,代码来源:test_uao_fault_inject.py


示例2: test_insert_commit_before_truncate

    def test_insert_commit_before_truncate(self):
        '''
        @description We suspend the vacuum on master after the first
                     transaction, and connect to segment.  Modify the
                     relation in vacuum and commit the segment local
                     transaction before the truncate transaction starts.
        '''
        fault_name = 'vacuum_relation_end_of_first_round'

        gpdbconfig = GPDBConfig()
        seghost, segport = gpdbconfig.get_hostandport_of_segment(0, 'p')
        filereputil = Filerepe2e_Util()
        filereputil.inject_fault(f=fault_name, y='suspend', seg_id='1')

        # run vacuum in background, it'll be blocked.
        sql_file1, ans_file1, out_file1 = self.get_file_names('conn1')
        psql1 = PSQL(sql_file=sql_file1, out_file=out_file1)
        thread1 = threading.Thread(target=self.run_psql, args=(psql1,))
        thread1.start()

        self.check_fault_triggered(fault_name)

        sql_file2, ans_file2, out_file2 = self.get_file_names('conn2')
        # utility to seg0
        psql2 = PSQL(sql_file=sql_file2, out_file=out_file2,
                     host=seghost, port=segport,
                     PGOPTIONS='-c gp_session_role=utility')
        self.run_psql(psql2)

        # resume vacuum
        filereputil.inject_fault(f=fault_name, y='reset', seg_id='1')
        thread1.join()
        self.assertTrue(Gpdiff.are_files_equal(out_file1, ans_file1))
        self.assertTrue(Gpdiff.are_files_equal(out_file2, ans_file2))
开发者ID:50wu,项目名称:gpdb,代码行数:34,代码来源:test_crossexec.py


示例3: do_test_fixture

 def do_test_fixture(self, fixture):
     """
     @summary: Runs a setup or teardown routine
     
     @param fixture: Set to either 'setup' or 'teardown'. Used to determine sql file suffix.
     """
     testcase1 = inspect.stack()[1][3] 
     testcase = self.id().split(".")[2]
     init_file = local_path('init_file') 
     init_file_list = []
     init_file_list.append(init_file)
     if fixture == 'setup':
         sqlfile = local_path(testcase + "_setup.sql")
         outfile = local_path(testcase + "_setup.out")
         ansfile = local_path(testcase + "_setup.ans")
     elif fixture == 'teardown':
         sqlfile = local_path(testcase + "_teardown.sql")
         outfile = local_path(testcase + "_teardown.out")
         ansfile = local_path(testcase + "_teardown.ans")
     else:
         raise Exception("do_test_fixture(): Invalid value for fixture. Acceptable values are 'setup' or 'teardown'")
     
     # check if setup sql file exists
     if os.path.isfile(sqlfile):
         # if exists, run setup sql, and validate result
         PSQL.run_sql_file(sql_file = sqlfile, out_file = outfile)            
         Gpdiff.are_files_equal(outfile, ansfile, match_sub=init_file_list)
     else:
         pass
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:29,代码来源:test_plpgsql.py


示例4: test_uao_crash_compaction_before_cleanup_phase_master_with_aocs

    def test_uao_crash_compaction_before_cleanup_phase_master_with_aocs(self):
        setup_file = self.get_sql_files("uao_crash_compaction_before_cleanup_phase_master_with_aocs_setup")[0]
        (sql_file1, out_file1,ans_file1) = self.get_sql_files("uao_crash_compaction_before_cleanup_phase_master_with_aocs1")
        (sql_file2, out_file2, ans_file2) = self.get_sql_files("uao_crash_compaction_before_cleanup_phase_master_with_aocs2")
        if not os.path.exists(os.path.dirname(out_file1)):
            os.mkdir(os.path.dirname(out_file1))
        set_fault_in_master_panic = 'source %s/greenplum_path.sh;gpfaultinjector -p %s -f compaction_before_cleanup_phase -y panic --seg_dbid 1'  % (os.getenv('GPHOME'), os.getenv('PGPORT'))
        set_fault_in_master_reset = 'source %s/greenplum_path.sh;gpfaultinjector -p %s -f compaction_before_cleanup_phase -y reset --seg_dbid 1'  % (os.getenv('GPHOME'), os.getenv('PGPORT'))
        cmd_type = 'fault injector'

        PSQL.run_sql_file(setup_file)
        gpfaultinjector = Command(cmd_type, set_fault_in_master_panic)

        gpfaultinjector.run()

        PSQL.run_sql_file(sql_file1, out_file=out_file1)
    
        result1 = Gpdiff.are_files_equal(out_file1, ans_file1)
        # The connection is accepted before it is actually ready, leading to panic messages
        # Therefore we have to sleep here.
        sleep(5)

        gpfaultinjector = Command(cmd_type, set_fault_in_master_reset)
        gpfaultinjector.run()

        PSQL.run_sql_file(sql_file2, out_file=out_file2)
        result2 = Gpdiff.are_files_equal(out_file2, ans_file2)
        self.assertTrue(result2)
开发者ID:LJoNe,项目名称:gpdb,代码行数:28,代码来源:test_uao_fault_inject.py


示例5: checkResult

    def checkResult(self, ifile, optionalFlags="", ignoreInfoLines = False):

        """
        PURPOSE: compare the actual and expected output files and report an 
            error if they don't match.
        PARAMETERS:
            ifile: the name of the .sql file whose actual and expected outputs 
                we want to compare.  You may include the path as well as the 
                filename.  This function will process this file name to 
                figure out the proper names of the .out and .ans files.
            optionalFlags: command-line options (if any) for diff.  
                For example, pass " -B " (with the blank spaces) to ignore 
                blank lines.
            ignoreInfoLines: set to True to ignore lines from gpcheckcat (and 
                possibly other sources) that contain "[INFO]" so we get diffs 
                only for errors, warnings, etc.
        LAST MODIFIED: 
            2010-05-06 mgilkey
                I added the ignoreInfoLines option so that we can ignore 
                differences in gpcheckcat output that are not significant.
            2010-02-17 mgilkey
                I added the "optionalFlags" parameter.
        """

        f1 = self.outFile(ifile)
        f2 = ansFile(ifile)
        self.appendMatchSub(f1)
        self.appendMatchSub(f2)
        Gpdiff.are_files_equal(out_file = f1, ans_file = f2)
        return True
开发者ID:HaozhouWang,项目名称:gpdb,代码行数:30,代码来源:MAPREDUCE.py


示例6: test_uao_crash_compaction_before_cleanup_phase

    def test_uao_crash_compaction_before_cleanup_phase(self):
        setup_file = self.get_sql_files("uao_crash_compaction_before_cleanup_phase_setup")[0]
        (sql_file1, out_file1, ans_file1) = self.get_sql_files("uao_crash_compaction_before_cleanup_phase1")
        (sql_file2, out_file2, ans_file2) = self.get_sql_files("uao_crash_compaction_before_cleanup_phase2")
        if not os.path.exists(os.path.dirname(out_file1)):
            os.mkdir(os.path.dirname(out_file1))

        PSQL.run_sql_file(setup_file)
        set_fault_in_seg_panic = 'source %s/greenplum_path.sh;gpfaultinjector -p %s -f compaction_before_cleanup_phase -y panic --seg_dbid 2'  % (os.getenv('GPHOME'), os.getenv('PGPORT'))
        set_fault_in_seg_reset = 'source %s/greenplum_path.sh;gpfaultinjector -p %s -f compaction_before_cleanup_phase -y reset --seg_dbid 2'  % (os.getenv('GPHOME'), os.getenv('PGPORT'))
        cmd_type = 'fault injector'
        gpfaultinjector = Command(cmd_type, set_fault_in_seg_panic)
        gpfaultinjector.run()

        PSQL.run_sql_file(sql_file1, out_file=out_file1)
        result1 = Gpdiff.are_files_equal(out_file1, ans_file1)

        gpfaultinjector = Command(cmd_type, set_fault_in_seg_reset)
        gpfaultinjector.run()

        PSQL.run_sql_file(sql_file2, out_file=out_file2)
        result2 = Gpdiff.are_files_equal(out_file2, ans_file2)

        self.assertTrue(result1)        
        self.assertTrue(result2)
开发者ID:LJoNe,项目名称:gpdb,代码行数:25,代码来源:test_uao_fault_inject.py


示例7: test_uao_crash_vacuum_with_ins_fault

    def test_uao_crash_vacuum_with_ins_fault(self):
        setup_file = self.get_sql_files("uaocs_crash_update_setup")[0]
        (sql_file1, out_file1,ans_file1) = self.get_sql_files("uao_crash_vacuum1")
        (sql_file2, out_file2, ans_file2) = self.get_sql_files("uao_crash_vacuum2")
        if not os.path.exists(os.path.dirname(out_file1)):
            os.mkdir(os.path.dirname(out_file1))
        set_fault_in_seg_panic = 'source %s/greenplum_path.sh;gpfaultinjector -p %s -f appendonly_insert -t foo -y panic --seg_dbid 2'  % (os.getenv('GPHOME'), os.getenv('PGPORT'))
        set_fault_in_seg_reset = 'source %s/greenplum_path.sh;gpfaultinjector -p %s -f appendonly_insert -t foo -y reset --seg_dbid 2'  % (os.getenv('GPHOME'), os.getenv('PGPORT'))
        cmd_type = 'fault injector'

        PSQL.run_sql_file(setup_file)
        gpfaultinjector = Command(cmd_type, set_fault_in_seg_panic)

        gpfaultinjector.run()

        PSQL.run_sql_file(sql_file1, out_file=out_file1)
    
        result1 = Gpdiff.are_files_equal(out_file1, ans_file1, match_sub=[gpdiff_init_file])

        PSQL.wait_for_database_up();

        gpfaultinjector = Command(cmd_type, set_fault_in_seg_reset)
        gpfaultinjector.run()

        PSQL.run_sql_file(sql_file2, out_file=out_file2)
        result2 = Gpdiff.are_files_equal(out_file2, ans_file2, match_sub=[gpdiff_init_file])

        self.assertTrue(result1)
        self.assertTrue(result2)
开发者ID:50wu,项目名称:gpdb,代码行数:29,代码来源:test_uao_fault_inject.py


示例8: test_uaocs_crash_alterdropcol

    def test_uaocs_crash_alterdropcol(self):
        setup_file = self.get_sql_files("uaocs_crash_update_setup")[0]
        (sql_file1, out_file1,ans_file1) = self.get_sql_files("uaocs_crash_alterdropcol1")
        (sql_file2, out_file2, ans_file2) = self.get_sql_files("uaocs_crash_alterdropcol2")
        if not os.path.exists(os.path.dirname(out_file1)):
            os.mkdir(os.path.dirname(out_file1))
        set_fault_in_seg_panic = 'source %s/greenplum_path.sh;gpfaultinjector -p %s -f appendonly_delete -t foo -y panic --seg_dbid 2'  % (os.getenv('GPHOME'), os.getenv('PGPORT'))
        set_fault_in_seg_reset = 'source %s/greenplum_path.sh;gpfaultinjector -p %s -f appendonly_delete -t foo -y reset --seg_dbid 2'  % (os.getenv('GPHOME'), os.getenv('PGPORT'))
        cmd_type = 'fault injector'

        PSQL.run_sql_file(setup_file)
        gpfaultinjector = Command(cmd_type, set_fault_in_seg_panic)

        gpfaultinjector.run()

        PSQL.run_sql_file(sql_file1, out_file=out_file1)
    
        result1 = Gpdiff.are_files_equal(out_file1, ans_file1)
        # The connection is accepted before it is actually ready, leading to panic messages
        # Therefore we have to sleep here.
        sleep(5)

        gpfaultinjector = Command(cmd_type, set_fault_in_seg_reset)
        gpfaultinjector.run()

        PSQL.run_sql_file(sql_file2, out_file=out_file2)
        result2 = Gpdiff.are_files_equal(out_file2, ans_file2)
        self.assertTrue(result2)
开发者ID:LJoNe,项目名称:gpdb,代码行数:28,代码来源:test_uao_fault_inject.py


示例9: run_test

    def run_test(self):
        sql_file = self.sql_file
        ans_file = self.ans_file
        
        source_file = sys.modules[self.__class__.__module__].__file__
        source_dir = os.path.dirname(source_file)
        out_file = os.path.join(self.get_out_dir(), os.path.basename(sql_file).replace('.sql', '.out'))


        guc_sql_file = self._add_gucs_to_sql_file(sql_file)
        adj_ans_file = self._add_opt_diff_too_ans_file(ans_file)
        PSQL.run_sql_file(guc_sql_file, dbname = self.db_name, out_file = out_file)

        init_files = []
        init_file_path = os.path.join(self.get_sql_dir(), 'init_file')
        if os.path.exists(init_file_path):
            init_files.append(init_file_path)


        if out_file[-2:] == '.t':
            out_file = out_file[:-2]

        if adj_ans_file is not None:
            if (self.executemode == 'normal'):
                result = Gpdiff.are_files_equal(out_file, ans_file, match_sub = init_files)
            elif (self.executemode == 'ORCA_PLANNER_DIFF'):
                out_file = os.path.join(self.get_out_dir(), os.path.basename(sql_file).replace('.sql', '.out'))
                new_ans_file = os.path.join(self.get_out_dir(), os.path.basename(ans_file).replace('.ans', '_mod.ans'))
                guc_sql_file = self._add_gucs_to_sql_file(sql_file)
                self.gucs.add('optimizer=off')
                self.gucs.add('optimizer_log=off')
                guc_off_sql_file = self._add_gucs_to_sql_file(sql_file)

                PSQL.run_sql_file(guc_off_sql_file, dbname = self.db_name, out_file = new_ans_file)
                PSQL.run_sql_file(guc_sql_file, dbname = self.db_name, out_file = out_file)

                sedcmd = "sed -i -e 's/transactionid,,,,,[[:digit:]]\+,,,,[[:digit:]]\+,[[:digit:]]\+,ExclusiveLock,t,[[:digit:]]\+,/transactionid,,,,,XXXXX,,,,XXXXX,XXXXX,ExclusiveLock,t,XXXXX,/' " +new_ans_file
                sedcmd2 = "sed -i -e 's/transactionid,,,,,[[:digit:]]\+,,,,[[:digit:]]\+,[[:digit:]]\+,ExclusiveLock,t,[[:digit:]]\+,/transactionid,,,,,XXXXX,,,,XXXXX,XXXXX,ExclusiveLock,t,XXXXX,/' " +out_file
                sedcmd3 = "sed -i -e 's/pg_aoseg_[[:digit:]]\+/pg_aoseg_XXXXX/' " +new_ans_file
                sedcmd4 = "sed -i -e 's/pg_aoseg_[[:digit:]]\+/pg_aoseg_XXXXX/' " +out_file
                run_shell_command(sedcmd, "replace dynamic values in planner output with XXXXX")
                run_shell_command(sedcmd2, "replace dynamic values in ORCA output with XXXXX")
                run_shell_command(sedcmd3, "replace dynamic values in pg_aoseg.pg_aoseg_")
                run_shell_command(sedcmd4, "replace dynamic values in pg_aoseg.pg_aoseg_")

                result = Gpdiff.are_files_equal(out_file, new_ans_file, match_sub = init_files)
            else:
                result = Gpdiff.are_files_equal(out_file, adj_ans_file, match_sub = init_files)

            if result == False:
                self.test_artifacts.append(out_file.replace('.out', '.diff'))

        return result
开发者ID:HaozhouWang,项目名称:gpdb,代码行数:53,代码来源:__init__.py


示例10: test_insert_unlock_before_truncate

    def test_insert_unlock_before_truncate(self):
        '''
        @description This is rather complicated.  We suspend the vacuum on
                     master after the first transaction, and connect to
                     segment, modify the relation in question, and release the
                     lock, keep the transaction.  To release the lock, we need
                     a special UDF.  Vacuum is supposed to skip truncate if it
                     sees such in-progress transaction.  Usually this should
                     not happen, but it rather simulates catalog DDL.
        '''
        fault_name = 'vacuum_relation_end_of_first_round'

        gpdbconfig = GPDBConfig()
        seghost, segport = gpdbconfig.get_hostandport_of_segment(0, 'p')
        filereputil = Filerepe2e_Util()
        filereputil.inject_fault(f=fault_name, y='suspend', seg_id='1')

        PSQL.run_sql_command(sql_cmd='drop table if exists sync_table; create table sync_table(a int)')
        # Use pygresql to keep the connection and issue commands seprately.
        # thread2 will wait on sync_table before finish its work, so we
        # can keep the transaction open until the vacuum completes its work.
        conn = pygresql.pg.connect(host=seghost, port=int(segport), opt='-c gp_session_role=utility')
        conn.query('begin')
        conn.query('lock sync_table in access exclusive mode')

        # run vacuum background, it'll be blocked.
        sql_file1, ans_file1, out_file1 = self.get_file_names('conn1')
        psql1 = PSQL(sql_file=sql_file1, out_file=out_file1)
        thread1 = threading.Thread(target=self.run_psql, args=(psql1,))
        thread1.start()

        self.check_fault_triggered(fault_name)

        sql_file2, ans_file2, out_file2 = self.get_file_names('conn2')
        # utility to seg0
        psql2 = PSQL(sql_file=sql_file2, out_file=out_file2,
                     host=seghost, port=segport,
                     PGOPTIONS='-c gp_session_role=utility')
        thread2 = threading.Thread(target=self.run_psql, args=(psql2,))
        thread2.start()

        # resume vacuum
        filereputil.inject_fault(f=fault_name, y='reset', seg_id='1')

        # Once thread1 finishes, we can now release the lock on sync_table,
        # so that thread2 can proceed.
        thread1.join()
        conn.query('commit')
        thread2.join()

        self.assertTrue(Gpdiff.are_files_equal(out_file1, ans_file1))
        self.assertTrue(Gpdiff.are_files_equal(out_file2, ans_file2))
开发者ID:50wu,项目名称:gpdb,代码行数:52,代码来源:test_crossexec.py


示例11: test_ignore_settings_and_rows_in_plans

    def test_ignore_settings_and_rows_in_plans(self):
        """
        Test whether gpdiff automatically ignores Settings: and number of rows in plan diffs.
        Two plans differing only in 'Settings:' and 'number of rows' should be consdiered the same.
        """
        file1 = os.path.join(os.path.dirname(__file__), 'explain_with_settings.out')
        file2 = os.path.join(os.path.dirname(__file__), 'explain_without_settings.out')

        self.assertTrue(Gpdiff.are_files_equal(file1, file2))

        # However other diffs should be considered
        file3 = os.path.join(os.path.dirname(__file__), 'explain_with_optimizer.out')
        self.assertFalse(Gpdiff.are_files_equal(file1, file3))
        self.assertFalse(Gpdiff.are_files_equal(file2, file3))
开发者ID:50wu,项目名称:gpdb,代码行数:14,代码来源:test_gpdiff.py


示例12: test_08_call_udf_gp_aovisimap_fordelete

    def test_08_call_udf_gp_aovisimap_fordelete(self):
        tinctest.logger.info("-------------------------------")
        tinctest.logger.info('test_08 Verify the usage of UDF gp_aovisimap in utility mode for deleted tuple')
        tinctest.logger.info("-------------------------------\n")
        out_file = os.path.join(self.outpath,'create_tab_gp_aovisimap_del_08.out')
        sql_file = os.path.join(self.sqlpath,'create_tab_gp_aovisimap_del_08.sql')
        ans_file= os.path.join(self.anspath,'create_tab_gp_aovisimap_del_08.ans')
	tablename='uao_visimap_test08'

	#create uao table and insert 10 rows
        sql_out=PSQL.run_sql_file(sql_file = sql_file,out_file=out_file)
	assert Gpdiff.are_files_equal(out_file, ans_file)
	#get relid for newly created table
        relid = self.get_relid(file_name=tablename )
	#get the segment_id where we'll log in utility mode and then get the hostname and port for this segment
        utilitymodeinfo=self.get_utilitymode_conn_info( relid=relid)
        u_port=utilitymodeinfo[0]
        u_host=utilitymodeinfo[1]

	before_tablerowcnt=self.get_rowcnt_table_on_segment(tablename=tablename, host=u_host,port=u_port)
	before_visimaprowcnt=self.get_visimap_cnt_on_segment(relid=relid,host=u_host,port=u_port)
	assert(int(before_visimaprowcnt) == 0)
	sql_cmd="delete from uao_visimap_test08 ;"
        PSQL.run_sql_command_utility_mode(sql_cmd=sql_cmd,host=u_host, port=u_port,flags='-q -t')	
	after_tablerowcnt=self.get_rowcnt_table_on_segment(tablename=tablename, host=u_host,port=u_port)
	after_visimaprowcnt=self.get_visimap_cnt_on_segment(relid=relid,host=u_host,port=u_port)
	assert(int(after_tablerowcnt) == 0)
开发者ID:LJoNe,项目名称:gpdb,代码行数:27,代码来源:test_persistant_table.py


示例13: run_test

    def run_test(self, data_file, sql_file, out_file, ans_file, table):
        base_dir = os.path.dirname(sys.modules[self.__module__].__file__)
        out_file = os.path.join(base_dir, 'output', out_file)
        ans_file = os.path.join(base_dir, 'expected', ans_file)
        sql_file = os.path.join(base_dir, 'sql', sql_file)

        data_out_file = os.path.join(base_dir, 'output', data_file.strip('.sql') + '.out')
        data_ans_file = os.path.join(base_dir, 'expected', data_file.strip('.sql') + '.ans')
        data_file = os.path.join(base_dir, 'sql', data_file) 

        PSQL.run_sql_file(data_file, out_file=data_out_file)
        self.assertTrue(Gpdiff.are_files_equal(data_out_file, data_ans_file))

        host, port = self._get_host_and_port_for_table(table)
        PSQL.run_sql_file_utility_mode(sql_file, host=host, port=port, out_file=out_file)
        self.assertTrue(Gpdiff.are_files_equal(out_file, ans_file))
开发者ID:LJoNe,项目名称:gpdb,代码行数:16,代码来源:test_indexscan.py


示例14: test_43_alter_table_with_oid

 def test_43_alter_table_with_oid(self):
     '''MPP-13870: Alter table Set Without Oids fails in case of inheritance'''
     sql_file = local_path('alter_table_with_oid.sql')
     out_file = local_path('alter_table_with_oid.out')
     ans_file = local_path('alter_table_with_oid.ans')
     PSQL.run_sql_file(sql_file = sql_file, out_file = out_file)
     self.assertTrue(Gpdiff.are_files_equal(out_file, ans_file))
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:7,代码来源:test_oid_inconsistency.py


示例15: doQuery

 def doQuery(self, sqlfile, default=''):
     sql_file = local_path(sqlfile)
     filename_prefix = sqlfile.split('.sql')[0]
     out_file = local_path(filename_prefix + '.out')
     ans_file = local_path(filename_prefix + '.ans')
     PSQL.run_sql_file(sql_file = sql_file, out_file = out_file)
     self.assertTrue(Gpdiff.are_files_equal(out_file, ans_file))
开发者ID:HaozhouWang,项目名称:gpdb,代码行数:7,代码来源:test_mapreduce.py


示例16: test_21_use_udf_gp_aovisimap_hidden_info_uao_upd_vacuum

    def test_21_use_udf_gp_aovisimap_hidden_info_uao_upd_vacuum(self):
        tablename ='uao_table_test11'
        tinctest.logger.info("-------------------------------")
        tinctest.logger.info('test_21 Verify the hidden tup_count using UDF gp_aovisimap_hidden_info(oid)  for uao relation after update_vacuum')
        tinctest.logger.info("-------------------------------\n")
        out_file = os.path.join(self.outpath,'create_tab_tupcount_in_pg_aoseg_uaotable_upd_11.out')
        sql_file = os.path.join(self.sqlpath,'create_tab_tupcount_in_pg_aoseg_uaotable_upd_11.sql')
        ans_file= os.path.join(self.anspath,'create_tab_tupcount_in_pg_aoseg_uaotable_upd_11.ans')

        #create uao table and insert 10 rows
        sql_out=PSQL.run_sql_file(sql_file = sql_file,out_file=out_file)
        assert Gpdiff.are_files_equal(out_file, ans_file)
        #get relid for newly created table
        relid = self.get_relid(file_name=tablename )

        #get relid for newly created table
        relid = self.get_relid(file_name=tablename )
        #get utility mode connection info
        utilitymodeinfo=self.get_utilitymode_conn_info( relid=relid)
        u_port=utilitymodeinfo[0]
        u_host=utilitymodeinfo[1]

        assert(0 == int(self.get_hidden_tup_cnt(relid=relid,host=u_host,port= u_port)))

        # update  rows
        sql_cmd3="update %s set j = 'test11' ;" % ( tablename)
        PSQL.run_sql_command_utility_mode(sql_cmd= sql_cmd3,host=u_host, port=u_port,flags='-q -t')

        assert(int(self.get_hidden_tup_cnt(relid=relid,host=u_host,port= u_port)) > 0)

        self.vacuum_full(tablename=tablename)
        assert(0 == int(self.get_hidden_tup_cnt(relid=relid,host=u_host,port= u_port)))
开发者ID:LJoNe,项目名称:gpdb,代码行数:32,代码来源:test_persistant_table.py


示例17: test_13_gp_persistent_relation_node_uaotable_del

    def test_13_gp_persistent_relation_node_uaotable_del(self):
        tablename = "uao_table_test13"
        tinctest.logger.info("-------------------------------")
        tinctest.logger.info(
            "test_13 Verify the eof mark in pg_aoseg and gp_persistant_rel_node table for uao relation after delete "
        )
        tinctest.logger.info("-------------------------------\n")
        out_file = os.path.join(self.outpath, "create_tab_gp_persistent_relation_node_uaotable_del_13.out")
        sql_file = os.path.join(self.sqlpath, "create_tab_gp_persistent_relation_node_uaotable_del_13.sql")
        ans_file = os.path.join(self.anspath, "create_tab_gp_persistent_relation_node_uaotable_del_13.ans")

        # create uao table and insert 10 rows
        sql_out = PSQL.run_sql_file(sql_file=sql_file, out_file=out_file)
        assert Gpdiff.are_files_equal(out_file, ans_file)
        # get relid for newly created table
        relid = self.get_relid(file_name=tablename)
        # get utility mode connection info
        utilitymodeinfo = self.get_utilitymode_conn_info(relid=relid)
        u_port = utilitymodeinfo[0]
        u_host = utilitymodeinfo[1]

        # get eof info before delete
        assert self.is_same_eof_uao_on_segment(relid=relid, host=u_host, port=u_port)

        # delete 1 row
        sql_cmd3 = "delete from %s  where i = (select min(i) from %s );" % (tablename, tablename)
        PSQL.run_sql_command_utility_mode(sql_cmd=sql_cmd3, host=u_host, port=u_port, flags="-q -t")
        self.vacuum_full(tablename=tablename)

        # get eof info after delete
        # eof_pg_aoseg_aft=self.get_eofuncompressed_pgaoseg_on_segment(relid=relid,host=u_host,port= u_port)
        # eof_gp_persistant_rel_node_aft=self.get_eof_gp_persistent_relation_node_on_segment(relid=relid,host=u_host,port= u_port)
        # assert (int(eof_pg_aoseg_aft) == (int(eof_gp_persistant_rel_node_aft)))
        assert self.is_same_eof_uao_on_segment(relid=relid, host=u_host, port=u_port)
开发者ID:andreasscherbaum,项目名称:gpdb,代码行数:34,代码来源:test_persistant_table.py


示例18: test_MPP24237

    def test_MPP24237(self):

        cmd_cleanup = "psql -Atc \"select datname from pg_database where datname != \'template0\'\" | while read a; do echo \"check for ${a}\";psql -Atc \"select \'drop schema if exists \' || nspname || \' cascade;\' from (select nspname from pg_namespace where nspname like \'pg_temp%\' union select nspname from gp_dist_random(\'pg_namespace\') where nspname like \'pg_temp%\' except select \'pg_temp_\' || sess_id::varchar from pg_stat_activity) as foo\" ${a}; done"

        res = {'rc':0, 'stderr':'', 'stdout':''}
        run_shell_command(cmd_cleanup, 'do_clean', res)

        if res['rc'] > 0:
            raise Exception("Failed to do cleanup %s" %res[stderr])

        PSQL.run_sql_file(local_path('pre_script.sql'), out_file=local_path('pre_script.out'))
        self.assertTrue(Gpdiff.are_files_equal(local_path('pre_script.out'), local_path('pre_script.ans')))

        cmd = "select count(*) from pg_tables where schemaname like 'pg_temp%';"
        out = PSQL.run_sql_command(cmd, flags ='-q -t')

        if int(out) != 0:
            tinctest.logger.info("temp tables found")
            tinctest.logger.info(PSQL.run_sql_command("select * from pg_tables where schemaname like 'pg_temp%';"))
            self.fail("temp tables were found")
            PSQL.run_sql_file(local_path('clean_script.sql'))

        PSQL.run_sql_file(local_path('clean_script.sql'))

        run_shell_command(cmd_cleanup, 'do_clean', res)
        if res['rc'] > 0:
            raise Exception("Failed to do cleanup %s" %res[stderr])
开发者ID:LJoNe,项目名称:gpdb,代码行数:27,代码来源:test_func_mpp24237.py


示例19: do_test

    def do_test(self, timeout=0, sqlfile=None, host=None, port=None, username=None, password=None, flags='-a', ans_version=False):
        """
        @summary: Run a test case
        
        @param timeout: Number of seconds to run sql file before timing out
        @param sqlfile: The path to sql file (relative to TEST.py directory)
        @param host: The GPDB master host name to use to connect to database
        @param port: The GPDB port used to make connections to the database
        @param username: The database username to use to connect to the database
        @param password: The password for the database user used to connect to database
        """
        (gpdb_version, build) = self.gpdb.GetGpdbVersion()
        if sqlfile is None:
            testcase = inspect.stack()[1][3]
            filename = testcase.split('test_')[1]
            sql_file = local_path(filename +".sql")
            out_file = local_path(filename + ".out")
            ans_file = local_path(filename + ".ans")
        else:
            sql_file = local_path(sqlfile)
            out_file = local_path(sqlfile.split('.')[0] + '.out')
            ans_file = local_path(sqlfile.split('.')[0] + '.ans')
        if ans_version:
            (gpdb_version, _) = self.gpdb.GetGpdbVersion()
            if gpdb_version.startswith('4.3'):
                ans_file = ans_file+'.4.3'

        init_file = local_path('init_file')
        init_file_list = []
        init_file_list.append(init_file)

        # run psql on file, and check result
        PSQL.run_sql_file(sql_file=sql_file, out_file=out_file, timeout=timeout, host=host, port=port, username=username, password=password,flags=flags)
        self.assertTrue(Gpdiff.are_files_equal(out_file, ans_file, match_sub=init_file_list))
开发者ID:PengJi,项目名称:gpdb-comments,代码行数:34,代码来源:test_plpgsql.py


示例20: test_ao_read_check_subtransaction

 def test_ao_read_check_subtransaction(self):
     sql_file = os.path.join(self.sql_dir, 'sub_transaction.sql') 
     ans_file = os.path.join(self.ans_dir, 'sub_transaction.ans') 
     out_file = os.path.join(self.output_dir, 'sub_transaction.out')
     PSQL.run_sql_file(sql_file=sql_file, out_file=out_file)
     if not Gpdiff.are_files_equal(out_file, ans_file):
         raise Exception('Subtransaction tests failed !')
开发者ID:HaozhouWang,项目名称:gpdb,代码行数:7,代码来源:test_ao_read_check.py



注:本文中的tinctest.lib.Gpdiff类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python logger.info函数代码示例发布时间:2022-05-27
下一篇:
Python lib.run_shell_command函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap