* Adjust job unit test.
This commit is contained in:
@@ -277,7 +277,7 @@ class compileModel extends model
|
||||
$response = common::http($url, '', array(CURLOPT_USERPWD => $userPWD));
|
||||
if(!$response) return;
|
||||
|
||||
$jobInfo = json_decode($response);
|
||||
$jobInfo = json_decode($response);
|
||||
if(empty($jobInfo)) return;
|
||||
|
||||
$compilePairs = $this->dao->select('queue,job')->from(TABLE_COMPILE)->where('job')->eq($job->id)->andWhere('queue')->gt(0)->fetchPairs();
|
||||
|
||||
@@ -1595,7 +1595,7 @@ class gitlabModel extends model
|
||||
{
|
||||
if(!is_string($params)) $params = json_encode($params);
|
||||
$url = sprintf($this->getApiRoot($gitlabID), "/projects/{$projectID}/pipeline");
|
||||
return json_decode(commonModel::http($url, $params, null, array("Content-Type: application/json")));
|
||||
return json_decode(commonModel::http($url, $params, array(), array("Content-Type: application/json")));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -400,7 +400,7 @@ class jobModel extends model
|
||||
$pipelineParams->ref = zget($pipeline, 'reference', '');
|
||||
if(!$pipelineParams->ref)
|
||||
{
|
||||
$project = $this->loadModel('gitlab')->apiGetSingleProject($job->server, $pipeline->project, false);
|
||||
$project = $this->loadModel('gitlab')->apiGetSingleProject($job->server, (int)$pipeline->project, false);
|
||||
$pipelineParams->ref = zget($project, 'default_branch', 'master');
|
||||
|
||||
$pipeline->reference = $pipelineParams->ref;
|
||||
@@ -423,7 +423,7 @@ class jobModel extends model
|
||||
|
||||
/* Run pipeline. */
|
||||
$compile = new stdclass;
|
||||
$pipeline = $this->loadModel('gitlab')->apiCreatePipeline($job->server, $pipeline->project, $pipelineParams);
|
||||
$pipeline = $this->loadModel('gitlab')->apiCreatePipeline($job->server, (int)$pipeline->project, $pipelineParams);
|
||||
if(empty($pipeline->id))
|
||||
{
|
||||
$this->gitlab->apiErrorHandling($pipeline);
|
||||
|
||||
@@ -10,7 +10,8 @@ title=jobModel->create();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 测试执行job id为1的情况属性status @created
|
||||
- 测试执行jenkins job的情况属性status @created
|
||||
- 测试执行gitlab job的情况属性status @created
|
||||
|
||||
*/
|
||||
|
||||
@@ -19,5 +20,5 @@ zdTable('job')->config('job')->gen(5);
|
||||
zdTable('compile')->gen(0);
|
||||
|
||||
$job = new jobTest();
|
||||
r($job->execTest(1)) && p('status')&& e('created'); // 测试执行job id为1的情况
|
||||
//r($job->execTest(3)) && p('id')&& e('2'); // 测试执行job id为3的情况
|
||||
r($job->execTest(1)) && p('status')&& e('created'); // 测试执行jenkins job的情况
|
||||
r($job->execTest(2)) && p('status')&& e('created'); // 测试执行gitlab job的情况
|
||||
@@ -10,7 +10,7 @@ title=jobModel->getLastTagByRepo();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 查询id为1的job的版本库的last tag @v0.1.2-light
|
||||
- 查询id为1的job的版本库的last tag @tag1
|
||||
|
||||
*/
|
||||
|
||||
@@ -19,4 +19,4 @@ zdTable('repo')->config('repo')->gen(5);
|
||||
|
||||
$jobID = 1;
|
||||
$job = new jobTest();
|
||||
r($job->getLastTagByRepoTest($jobID)) && p() && e('v0.1.2-light'); // 查询id为1的job的版本库的last tag
|
||||
r($job->getLastTagByRepoTest($jobID)) && p() && e('tag1'); // 查询id为1的job的版本库的last tag
|
||||
|
||||
@@ -46,7 +46,7 @@ fields:
|
||||
range: 3{1},1{1}
|
||||
- field: pipeline
|
||||
note: "流水线"
|
||||
range: '[/job/hello%20world/],[{"project":"1569"}],[/job/simple-job/],[],[/job/paramsJob/]'
|
||||
range: '[/job/hello%20world/],[{"project":"2"}],[/job/simple-job/],[],[/job/paramsJob/]'
|
||||
- field: triggerType
|
||||
note: "触发方式"
|
||||
range: tag,commit,schedule
|
||||
|
||||
@@ -8,9 +8,9 @@ fields:
|
||||
- field: product
|
||||
range: 1
|
||||
- field: name
|
||||
range: zentaopms,zentaopms2
|
||||
range: testHtml,testHtml2
|
||||
- field: path
|
||||
range: "http://10.0.7.242:9980/root/zentaopms"
|
||||
range: "http://gitlabdev.qc.oop.cc/gitlab-instance-76af86df/testhtml"
|
||||
- field: SCM
|
||||
range: Gitlab
|
||||
- field: client
|
||||
@@ -18,7 +18,7 @@ fields:
|
||||
- field: serviceHost
|
||||
range: 1
|
||||
- field: serviceProject
|
||||
range: 9
|
||||
range: 2
|
||||
- field: extra
|
||||
range: 9
|
||||
- field: preMerge
|
||||
|
||||
Reference in New Issue
Block a user