本文整理汇总了Python中OSConf.get_app_uuid_X方法的典型用法代码示例。如果您正苦于以下问题:Python OSConf.get_app_uuid_X方法的具体用法?Python OSConf.get_app_uuid_X怎么用?Python OSConf.get_app_uuid_X使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSConf
的用法示例。
在下文中一共展示了OSConf.get_app_uuid_X方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_method
# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_app_uuid_X [as 别名]
def test_method(self):
app_name = self.app_name
self.steps_list.append(testcase.TestCaseStep("Create a %s application" %(self.app_type),
common.create_app,
function_parameters=[self.app_name, self.app_type, self.config.OPENSHIFT_user_email, self.config.OPENSHIFT_user_passwd],
expect_return=0,
expect_description="App should be created successfully"))
#this will be as __OUTPUT__[2]
self.steps_list.append(testcase.TestCaseStep("Get app url",
OSConf.get_app_url_X,
function_parameters = [self.app_name]))
#this will be as __OUTPUT__[3]
self.steps_list.append(testcase.TestCaseStep("Get app uuid",
OSConf.get_app_uuid_X,
function_parameters = [self.app_name]))
#4
self.steps_list.append(testcase.TestCaseStep("Embed MongoDB to this app",
common.embed,
function_parameters=[self.app_name,
"add-%s"%common.cartridge_types['mongodb'],
self.config.OPENSHIFT_user_email,
self.config.OPENSHIFT_user_passwd],
expect_return=0))
#5
self.steps_list.append(testcase.TestCaseStep("Get embeded mongo info - password",
OSConf.get_embed_info_X,
function_parameters=[self.app_name, common.cartridge_types["mongodb"], "password"]))
#6
self.steps_list.append(testcase.TestCaseStep("Get embeded mongo info - url",
OSConf.get_embed_info_X,
function_parameters=[self.app_name, common.cartridge_types["mongodb"], "url"]))
mongo_shell_write_input_file = "./mongo_shell_write_input"
mongo_shell_read_input_file = "./config.mongo_shell_read_input"
test_Collection_name = "test"
test_data = "TesterName"
#7
command = """echo -e 'use %s\ndb\nshow collections\ndb.%s.save({"name":"%s"})\nexit\n' >%s""" %(self.app_name, test_Collection_name, test_data, mongo_shell_write_input_file)
self.steps_list.append(testcase.TestCaseStep("Write mongo shell input file - write",
command,
expect_return=0))
command = """echo -e 'use %s\ndb\nshow collections\ndb.%s.find()\nexit\n' >%s""" %(self.app_name, test_Collection_name, mongo_shell_read_input_file)
#8
self.steps_list.append(testcase.TestCaseStep("Write mongo shell input file - read",
command,
expect_return=0))
#9
self.steps_list.append(testcase.TestCaseStep("Do some write operation to mongodb",
"""ssh -t -t %[email protected]%s rhcsh mongo < %s""" ,
#%("__OUTPUT__[3]", "__OUTPUT__[2]", mongo_shell_write_input_file),
string_parameters = [OSConf.get_app_uuid_X(self.app_name),
OSConf.get_app_url_X(self.app_name),
mongo_shell_write_input_file],
expect_return=0,
expect_string_list=["Welcome to OpenShift shell", "MongoDB shell", self.app_name],
unexpect_string_list=["errmsg"]))
#10
self.steps_list.append(testcase.TestCaseStep(
"Do some query operation to mongodb to check write operation is succesful",
"""ssh -t -t %[email protected]%s rhcsh mongo < %s""",
#%("__OUTPUT__[3]", "__OUTPUT__[2]", mongo_shell_read_input_file),
string_parameters = [OSConf.get_app_uuid_X(self.app_name),
OSConf.get_app_url_X(self.app_name),
mongo_shell_read_input_file],
expect_return=0,
expect_string_list=["Welcome to OpenShift shell", "MongoDB shell", app_name, test_Collection_name, test_data],
unexpect_string_list=["errmsg"]))
#11
self.steps_list.append(testcase.TestCaseStep("Stop this embed db using 'rhc cartridge stop'",
"rhc cartridge stop %s -a %s -l %s -p '%s' %s"
%(common.cartridge_types['mongodb'], app_name, self.config.OPENSHIFT_user_email, self.config.OPENSHIFT_user_passwd, common.RHTEST_RHC_CLIENT_OPTIONS),
expect_return=0))
self.steps_list.append(testcase.TestCaseStep("Check this db status",
"rhc cartridge status %s -a %s -l %s -p '%s' %s" %(common.cartridge_types['mongodb'], app_name, self.config.OPENSHIFT_user_email, self.config.OPENSHIFT_user_passwd, common.RHTEST_RHC_CLIENT_OPTIONS),
expect_return=0,
expect_string_list=["MongoDB is stopped"]))
#12
self.steps_list.append(testcase.TestCaseStep(
"Try to do some query operation to mongodb to check db is NOT running",
"""ssh -t -t %[email protected]%s rhcsh mongo < %s""" ,
#%("__OUTPUT__[3]", "__OUTPUT__[2]", mongo_shell_read_input_file),
string_parameters = [OSConf.get_app_uuid_X(self.app_name),
OSConf.get_app_url_X(self.app_name),
mongo_shell_read_input_file],
expect_return = "!0",
expect_string_list=["Welcome to OpenShift shell", "MongoDB shell", "connect failed"],
unexpect_string_list=[test_data,]))
#.........这里部分代码省略.........