本文整理汇总了Python中mpp.gpdb.tests.storage.walrepl.gpinitstandby.GpinitStandby.verify_gpinitstandby方法的典型用法代码示例。如果您正苦于以下问题:Python GpinitStandby.verify_gpinitstandby方法的具体用法?Python GpinitStandby.verify_gpinitstandby怎么用?Python GpinitStandby.verify_gpinitstandby使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpp.gpdb.tests.storage.walrepl.gpinitstandby.GpinitStandby
的用法示例。
在下文中一共展示了GpinitStandby.verify_gpinitstandby方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GpinitStandsbyTestCase
# 需要导入模块: from mpp.gpdb.tests.storage.walrepl.gpinitstandby import GpinitStandby [as 别名]
# 或者: from mpp.gpdb.tests.storage.walrepl.gpinitstandby.GpinitStandby import verify_gpinitstandby [as 别名]
class GpinitStandsbyTestCase(MPPTestCase):
''' Testcases for gpinitstandby'''
db_name = 'walrepl'
standby_port = '5433'
standby_dirname = 'newstandby'
def __init__(self, methodName):
self.gp = GpinitStandby()
self.host = socket.gethostname()
self.mdd = os.environ.get('MASTER_DATA_DIRECTORY')
self.standby = self.gp.get_standbyhostnode()
self.standby_loc = os.path.join(os.path.split(self.mdd)[0],
self.standby_dirname)
self.primary_pid = 0
super(GpinitStandsbyTestCase,self).__init__(methodName)
def setUp(self):
#Remove standby if present
self.primary_pid = self.gp.get_primary_pid()
self.gp.run(option='-r')
def tearDown(self):
# Cleanup Filespaces
walrepl.cleanupFilespaces(dbname=self.db_name)
def create_directory(self,location):
pgutil.clean_dir(self.standby,os.path.split(location)[0])
pgutil.create_dir(self.standby,os.path.split(location)[0])
def create_unmodifiable_file(self, filename):
filepath = os.path.join(self.mdd, filename)
with open(filepath, 'w') as fp:
pass
os.chmod(filepath, 000)
def remove_unmodifiable_file(self, filename):
filepath = os.path.join(self.mdd, filename)
os.chmod(filepath, 777)
os.remove(filepath)
def touch_file(self, filename):
file_dir = os.path.split(filename)[0]
if not os.path.exists(file_dir):
os.makedirs(file_dir)
with open(filename, 'w') as fp:
pass
def test_gpinitstandby_exclude_dirs(self):
"""
Test pg_basebackup exclusions when copying filespaces from
the master to the standby during gpinitstandby
"""
os.makedirs(self.mdd + '/db_dumps')
self.touch_file(self.mdd + '/db_dumps/testfile')
self.touch_file(self.mdd + '/gpperfmon/logs/test.log')
self.touch_file(self.mdd + '/gpperfmon/data/testfile')
self.touch_file(self.mdd + '/pg_log/testfile')
self.gp.run(option = '-P %s -s %s -F pg_system:%s' % (self.standby_port, self.host, self.standby_loc))
shutil.rmtree(self.mdd + '/db_dumps')
os.remove(self.mdd + '/gpperfmon/logs/test.log')
os.remove(self.mdd + '/gpperfmon/data/testfile')
os.remove(self.mdd + '/pg_log/testfile')
self.assertFalse(os.path.exists(self.standby_loc + '/db_dumps/testfile'))
self.assertFalse(os.path.exists(self.standby_loc + '/gpperfmon/logs/test.log'))
self.assertFalse(os.path.exists(self.standby_loc + '/gpperfmon/data/testfile'))
self.assertFalse(os.path.exists(self.standby_loc + '/pg_log/testfile'))
self.assertTrue(self.gp.run(option = '-r'))
@unittest.skipIf(not config.is_multinode(), "Test applies only to a multinode cluster")
def test_gpinitstanby_to_new_host(self):
self.create_directory(self.mdd)
self.assertTrue(self.gp.run(option = '-s %s' % self.standby))
self.assertTrue(self.gp.verify_gpinitstandby(self.primary_pid))
def test_gpinitstandby_to_same_host_new_port_and_new_mdd(self):
pgutil.clean_dir(self.host,self.standby_loc)
self.assertTrue(self.gp.run(option = '-P %s -s %s -F pg_system:%s' % (self.standby_port, self.host, self.standby_loc)))
self.assertTrue(self.gp.verify_gpinitstandby(self.primary_pid))
@unittest.skipIf(not config.is_multinode(), "Test applies only to a multinode cluster")
def test_gpinitstandby_new_host_new_port(self):
self.create_directory(self.mdd)
self.assertTrue(self.gp.run(option = '-P %s -s %s' % (self.standby_port, self.standby)))
self.assertTrue(self.gp.verify_gpinitstandby(self.primary_pid))
@unittest.skipIf(not config.is_multinode(), "Test applies only to a multinode cluster")
def test_gpinitstandby_new_host_new_mdd(self):
self.create_directory(self.standby_loc)
self.assertTrue(self.gp.run(option = '-F pg_system:%s -s %s' % (self.standby_loc, self.standby)))
self.assertTrue(self.gp.verify_gpinitstandby(self.primary_pid))
#.........这里部分代码省略.........