def test_connect2(): # 通过 job url 获取 server 和 job_name server, job_name = auto_jenkins.connect_job(JOB_URL) assert JOB_NAME == job_name build_params = {"xqyEnv": "xqy-test", "ucEnv": "uc-sit"} server.build_checkbox_job(job_name, build_params, checkbox="activity,boss")
def test_build_job_no_param(): """构建任务无构建参数""" server, job_name = connect_job("http://192.168.110.173:8080/jenkins/job/invoice-api-test/", username="******", password="******") pprint.pprint(server.get_job_info(job_name).build_params.default_parameter_values)
def test_get_server(): server, job_name = auto_jenkins.connect_job( "http://10.199.132.55:8181/jenkins/api-test-xqy-finance", username="******", password="******") job_info = server.get_job_info(job_name) print(job_info.name)
def test_connect3(): # 通过 job url 获取 server 和 job_name server, job_name = auto_jenkins.connect_job( "http://10.199.132.55:8181/jenkins/job/SyncIris/") assert JOB_NAME == job_name build_params = {"xqyEnv": "xqy-test", "ucEnv": "uc-sit"} server.build_checkbox_job(job_name, build_params, checkbox="activity,boss")
def test_build_job_checkbox(): """构建任务的参数是 checkbox """ server, job_name = connect_job("http://10.199.132.55:8181/jenkins/job/bixiaopeng_demo/", username="******", password="******") # parameters = { # 'env': "test" # } server.build_checkbox_job(job_name, {'env': 'test', 'plevel': 'all'},checkbox="wlqd")
def test_build_job(): """测试获取定义的参数信息列表""" server, job_name = auto_jenkins.connect_job( "http://10.199.132.55:8181/jenkins/view/apitest/job/api-test-uc/", username="******", password="******") print(server.get_job_info(job_name).build_params.defines) parameters = {'env': "test"}
def test_get_build_params_defines_profile(): """测试获取定义的参数信息列表(性能测试那个)""" server, job_name = auto_jenkins.connect_job( "http://10.98.17.52:8082/jenkins/job/xqy_jmeter_test/", username="******", password="******") pprint.pprint(server.get_job_info(job_name).build_params.defines) parameters = {'api': "", 'jmx_path': '', 'times': '', 'period': ''} # server.build_job() job_info = server.get_job_info(job_name) print(job_info.last_build.number)
def test_connect(): # 通过 job url 获取 server 和 job_name server, job_name = auto_jenkins.connect_job(JOB_URL) assert JOB_NAME == job_name defines = server.get_job_info(job_name).build_params.defines # 通过 jenkins 获取 server server2 = auto_jenkins.connect_jenkins(JENKINS_URL) defines2 = server2.get_job_info(JOB_NAME).build_params.defines # 直接通过 Jenkins 这个类连接 server3 = auto_jenkins.Jenkins(JENKINS_URL) defines3 = server3.get_job_info(JOB_NAME).build_params.defines pprint.pprint(defines) assert defines == defines2 == defines3
def test_get_build_params_defines(): """测试获取定义的参数信息列表""" server, job_name = auto_jenkins.connect_job( "http://10.199.132.55:8181/jenkins/job/api-test-xqy-finance", username="******", password="******") print(server.get_job_info(job_name).build_params.defines) job_info = server.get_job_info(job_name) print(job_info.last_build.number) queue_item = server.build_job(job_name, parameters={ 'env': "test", 'module': "finance", 'plevel': "p1" }) print(job_info.is_in_queue) print(job_info.buildable) print(job_info.next_build_number)