* Adjust job unit test.

This commit is contained in:
zenggang
2023-12-12 09:08:23 +00:00
parent 59baaaf300
commit 08eff55ac2
7 changed files with 14 additions and 13 deletions
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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")));
}
/**
+2 -2
View File
@@ -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);
+4 -3
View File
@@ -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的情况
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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