示例#1
0
    def stop_start_validate(self, expect_down_segments=False):
        """
        Do gpstop -i, gpstart and see if all segments come back up fine 
        """
        self.gpstart = GpStart()
        self.gpstop = GpStop()
        tinctest.logger.info("[STLRTest] Running stop_start_validate")

        tinctest.logger.info("[STLRTest]Shutting down the cluster")
        ok = self.gpstop.run_gpstop_cmd(immediate='i')
        if not expect_down_segments:
            if not ok:
                raise Exception(
                    '[STLRTest]Problem while shutting down the cluster')
            tinctest.logger.info(
                "[STLRTest]Successfully shutdown the cluster.")

        tinctest.logger.info("[STLRTest]Restarting the cluster.")
        ok = self.gpstart.run_gpstart_cmd()

        if not ok:
            raise Exception('[STLRTest]Failed to bring the cluster back up')
        tinctest.logger.info("[STLRTest]Successfully restarted the cluster.")
        if not self.anydownsegments():
            raise Exception("[STLRTest]segments were marked down")
        else:
            return (True, "All segments are up")
示例#2
0
    def __init__(self, host, usr, db, entry_type="host", authmethod="password", password=None):
        """ 
        Constructor for GpUserRole 
        @param host: which host to be tested;
        @param usr: user name to login host and login database;
        @param db: database name
        @change: Ritesh Jaltare
        @param entry_type: if a user is created, then we need the type of entry for pg_hba.conf for authen eg host, local, hostssl
        @param authmethod: denotes the authentication method used, eg: trust , password, md5
        @param address: denotes the IP address of the host. it can be both IPV4 or IPV6
        """
        self.gpstop = GpStop()
        self.host = host
        if password is None:
	  self.password = r"'password'"
        else:
          self.password = password
        self.usr = usr
        self.db = db
        if self.db is "all":
            self.pgpassdb = "*"
        else:
            self.pgpassdb=self.db    
        gpconfig = GpConfig()
        masterSSLValue = gpconfig.getParameterMasterOnly("ssl")
        if masterSSLValue is "on" and entry_type is "host":
            self.entry_type = "hostssl"
        else:
            self.entry_type = entry_type    
        
        self.authmethod = authmethod
        if os.path.exists(PGPASSFILE) is False:
            file = open(PGPASSFILE, 'w')
            os.chmod(PGPASSFILE,0600)
示例#3
0
 def __init__(self, methodName):
     self.pgport = os.environ.get('PGPORT')
     self.fileutil = Filerepe2e_Util()
     self.gpstate = Gpstate()
     self.gpprimarymirror = Gpprimarymirror()
     self.gpstart = GpStart()
     self.gpstop = GpStop()
     super(FtsTransitions,self).__init__(methodName)
示例#4
0
 def __init__(self):
     self.gpstart = GpStart()
     self.gpstop = GpStop()
     self.config = GpConfig()
     self.port = os.getenv('PGPORT')
     self.gphome = (os.getenv('GPHOME'))
     self.base_dir = os.path.dirname(
         sys.modules[self.__class__.__module__].__file__)
示例#5
0
	def setUp(self):
                self.basedir = os.path.dirname(__file__)
		self.gphome = os.environ.get('GPHOME')
                self.gp=GpStart()
                self.gps=GpStop()
                self.MAX_TRY=3
                self.TIMEOUT=90
                self.MAXPARALLELSEG=60
 def remove_user(self):
     pghba = PgHba()
     for role in ('dsp_role1', 'dsp_role2', 'dsp_role3', 'dsp_role4', 'dsp_role5'):
         entries = pghba.search( user = role )
         for ent in entries:
             ent.delete()
         pghba.write()
     gpstop = GpStop()
     gpstop.run_gpstop_cmd(reload=True) # reload to activate the users
示例#7
0
 def stop_db(self):
     """
     @summary: Stops the greenplum DB based on the options provided
     
     @param option: represents different gpstop command options
     @return: output of the executed command as a string
     """        
     gpstop = GpStop()
     gpstop.run_gpstop_cmd()
示例#8
0
 def reset_gpconfig(self, param):
     ''' Reset the configuration parameter '''
     command = "gpconfig -r %s " % (param)
     rc = run_shell_command(command)
     if not rc:
         raise Exception('Unable to reset the configuration parameter %s ' %
                         param)
     gpstop = GpStop()
     gpstop.run_gpstop_cmd(restart=True)
示例#9
0
 def tearDown(self):
     # just stop the cluster if there is a failure, to preserve the data directories for debugging
     if self._resultForDoCleanups.failures or self._resultForDoCleanups.errors:
         result = True
         try:
             result = GpStop().run_gpstop_cmd(mdd=os.path.join(self.testcase_master_dir, 'gpseg-1'))
         except Exception, e:
             tinctest.logger.exception(e)
             tinctest.logger.warning("gpstop failed with errors / warnings")
示例#10
0
 def __init__(self, methodName):
     self.pgport = os.environ.get('PGPORT')
     self.util = Filerepe2e_Util()
     self.gpconfig = GpConfig()
     self.config = GPDBConfig()
     self.gpr = GpRecover(self.config)
     self.dbstate = DbStateClass('run_validation', self.config)
     self.gpstart = GpStart()
     self.gpstop = GpStop()
     super(FilerepTestCase, self).__init__(methodName)
示例#11
0
 def __init__(self, methodName):
     self.filereputil = Filerepe2e_Util()
     self.config = GPDBConfig()
     self.gprecover = GpRecover(self.config)
     self.gpstop = GpStop()
     self.gpstart = GpStart()
     self.gpverify = GpdbVerify(config=self.config)
     self.dbstate = DbStateClass('run_validation', self.config)
     self.port = os.getenv('PGPORT')
     super(PgtwoPhaseClass, self).__init__(methodName)
示例#12
0
 def set_gpconfig(self, param, value):
     ''' Set the configuration parameter using gpconfig '''
     command = "gpconfig -c %s -v \"\'%s\'\" --skipvalidation" % (param,
                                                                  value)
     rc = run_shell_command(command)
     if not rc:
         raise Exception('Unable to set the configuration parameter %s ' %
                         param)
     gpstop = GpStop()
     gpstop.run_gpstop_cmd(restart=True)
示例#13
0
 def __init__(self,methodName):
     self.fileutil = Filerepe2e_Util()
     self.config = GPDBConfig()
     self.gprecover = GpRecover(self.config)
     self.gpstart = GpStart()
     self.gpstop = GpStop()
     self.gpfile = Gpfilespace(self.config)
     self.dbstate = DbStateClass('run_validation', self.config)
     self.port = os.getenv('PGPORT')
     self.base = GPDBStorageBaseTestCase()
     super(SuspendCheckpointCrashRecovery,self).__init__(methodName)
示例#14
0
 def setUpClass(cls):
     super(AppendOnlyEOFTests, cls).setUpClass()
     gpconfig = GpConfig()
     (cls.master_value, cls.segment_value) = gpconfig.getParameter('max_appendonly_tables')
     tinctest.logger.debug("Original max_appendonly_tables values - Master Value: %s Segment Value: %s" %(cls.master_value, cls.segment_value))
     gpconfig.setParameter('max_appendonly_tables', '3', '3')
     GpStop().run_gpstop_cmd(restart=True)
     (master_value, segment_value) = gpconfig.getParameter('max_appendonly_tables')
     tinctest.logger.debug("Set max_appendonly_tables to Master Value: %s  Segment Value: %s " %(master_value, segment_value))
     if master_value != '3' or segment_value != '3':
         raise Exception("Failed to set max_appendonly_tables to the required values")
示例#15
0
 def run_restart_database(self):
     '''
     @summary : Restart the database
     '''
     self.gpstart = GpStart()
     self.gpstop = GpStop()
     tinctest.logger.info("[STLRTest] Running run_restart_database")
     ok = self.gpstop.run_gpstop_cmd(immediate='i')
     tinctest.logger.info(ok)
     ok = self.gpstart.run_gpstart_cmd()
     tinctest.logger.info(ok)
示例#16
0
 def remove_user(self, role):
     """
     @description: Remove an entry for user in pg_hba.conf
     """
     pghba = PgHba()
     entries = pghba.search( user = role )
     for ent in entries:
         ent.delete()
     pghba.write()
     gpstop = GpStop()
     gpstop.run_gpstop_cmd(reload=True) # reload to activate the users
示例#17
0
    def __init__(self, config=None):
        if config is not None:
            self.config = config
        else:
            self.config = GPDBConfig()

        self.filereputil = Filerepe2e_Util()
        self.gprecover = GpRecover(self.config)
        self.gpstop = GpStop()
        self.gpstart = GpStart()
        self.gpverify = GpdbVerify(config=self.config)
        self.dbstate = DbStateClass('run_validation', self.config)
        self.port = os.getenv('PGPORT')
示例#18
0
    def tearDownClass(cls):
        gpconfig = GpConfig()
        if (not cls.master_value) or (not cls.segment_value):
            raise Exception("Original max_appendonly_tables value is None")

        gpconfig.setParameter('max_appendonly_tables', cls.master_value, cls.segment_value)
        GpStop().run_gpstop_cmd(restart=True)
        # Make sure the values are reset properly
        (master_value, segment_value) = gpconfig.getParameter('max_appendonly_tables')
        try:
            if master_value != cls.master_value or segment_value != cls.segment_value:
                raise Exception("Failed to reset max_appendonly_tables to the required values")
        finally:
            super(AppendOnlyEOFTests, cls).tearDownClass()
示例#19
0
 def run_restart_database(self):
     '''
     @summary : Restart the database
     '''
     self.gpstart = GpStart()
     self.gpstop = GpStop()
     tinctest.logger.info("[STLRTest] Running run_restart_database")   
     ok = self.gpstop.run_gpstop_cmd(immediate = 'i')
     tinctest.logger.info(ok)
     ok = self.gpstart.run_gpstart_cmd()
     tinctest.logger.info(ok)       
     tinctest.logger.info("[STLRTest] printing gp segment configuration")
     (gp_seg_conf) = PSQL.run_sql_command("select * from gp_segment_configuration order by dbid")
     tinctest.logger.info(gp_seg_conf)
示例#20
0
    def add_user(self, role, mode):
        """
        @description: Add an entry for each user in pg_hba.conf
        """
        pghba = PgHba()
        new_entry = Entry(entry_type='local',
                            database = 'all',
                            user = role,
                            authmethod = mode)
        pghba.add_entry(new_entry)
        pghba.write()
        # Check if the roles are added correctly
        res = pghba.search(type='local',
                        database='all',
                        user = role,
                        authmethod= mode)
        if not res:
            raise Exception('The entry is not added to pg_hba.conf correctly')

        gpstop = GpStop()
        gpstop.run_gpstop_cmd(reload=True) # reload to activate the users
示例#21
0
def setUpModule():
    """
    gpstop a cluster if up and running. Since the tests take care of initsystem themselves and CI sets up a cluster for now,
    we do this at the beginning of this module
    """
    tinctest.logger.info("Setting up test module. gpstop and gpseginstall")
    result = True
    try:
        result = GpStop().run_gpstop_cmd()
    except:
        tinctest.logger.warning("gpstop failed with errors / warnings")
    if not result:
        tinctest.logger.warning("gpstop failed with errors / warnings")
    
    #return
    hosts = get_gpexpand_hosts()
    cmd = GpSegInstall(os.environ.get('GPHOME'), hosts)
    result = cmd.run(validate=True)
    if result.rc > 0:
        tinctest.logger.error("gpseginstall failed with an error code: %s" %result)
        raise GPExpandTestCaseException("gpseginstall failed with an error code. Failing the test module")
    tinctest.logger.info("Finished setting up test module successfully")
示例#22
0
 def __init__(self, methodName):
     self.gpstop = GpStop()
     self.dbname = os.environ.get('PGDATABASE')
     super(languageTestCase, self).__init__(methodName)
示例#23
0
 def restart(self):
     # GpStop does not accept immedaite and restart both...
     GpStop().run_gpstop_cmd(immediate=True)
     GpStart().run_gpstart_cmd()
示例#24
0
文件: __init__.py 项目: zlyswjtu/gpdb
 def __init__(self, methodName):
     self.gpstop = GpStop()
     super(PgcryptoMPPTestCase, self).__init__(methodName)