* [unittest] adjust ci syncCompile unittest case.

This commit is contained in:
caoyanyi
2025-06-05 13:13:07 +08:00
parent 1db450bc6f
commit e6b6d7101c
3 changed files with 7 additions and 6 deletions
+1
View File
@@ -231,6 +231,7 @@ class ciModel extends model
$pipeline = $this->loadModel('gitlab')->apiGetSinglePipeline($compile->server, $compile->project, $compile->queue);
if(!isset($pipeline->id) || isset($pipeline->message)) /* The pipeline is not available. */
{
$this->dao->update(TABLE_COMPILE)->set('status')->eq('failure')->where('id')->eq($compile->id)->exec();
$this->dao->update(TABLE_JOB)->set('lastExec')->eq($now)->set('lastStatus')->eq('create_fail')->where('id')->eq($compile->job)->exec();
return false;
}
+5 -5
View File
@@ -9,9 +9,9 @@ cid=1
- 同步jenkins构建结果属性status @created
- 同步gitlab构建结果属性status @failed
- 三次请求没有拿到结果,构建失败属性status @failure
- 5次请求没有拿到结果,构建失败属性status @failure
- 同步jenkins构建结果,有合并请求ID属性status @created
- 三次请求没有拿到结果,通知MR失败属性status @failure
- 5次请求没有拿到结果,通知MR失败属性status @failure
*/
@@ -26,10 +26,10 @@ su('admin');
libxml_use_internal_errors(true);
$ci = new ciTest();
r($ci->syncCompileStatusTest(1)) && p('status') && e('created'); // 同步jenkins构建结果
r($ci->syncCompileStatusTest(1)) && p('status') && e('created'); // 同步jenkins构建结果
r($ci->syncCompileStatusTest(2)) && p('status') && e('failed'); // 同步gitlab构建结果
r($ci->syncCompileStatusTest(4)) && p('status') && e('failure'); // 三次请求没有拿到结果,构建失败
r($ci->syncCompileStatusTest(6)) && p('status') && e('failure'); // 5次请求没有拿到结果,构建失败
r($ci->syncCompileStatusTest(1, 1)) && p('status') && e('created'); // 同步jenkins构建结果,有合并请求ID
r($ci->syncCompileStatusTest(5, 1)) && p('status') && e('failure'); // 三次请求没有拿到结果,通知MR失败
r($ci->syncCompileStatusTest(6, 1)) && p('status') && e('failure'); // 5次请求没有拿到结果,通知MR失败
+1 -1
View File
@@ -18,4 +18,4 @@ fields:
- field: tag
range: release
- field: times
range: 0,1-4
range: 0,1-5