Search in sources :

Example 1 with QueueTaskFuture

use of hudson.model.queue.QueueTaskFuture in project sonar-scanner-jenkins by SonarSource.

the class WaitForQualityGateStepTest method waitForQualityGateOk_survive_restart.

@Test
public void waitForQualityGateOk_survive_restart() {
    story.addStep(new Statement() {

        @Override
        public void evaluate() throws Throwable {
            handler.status = "PENDING";
            QueueTaskFuture<WorkflowRun> pipeline = submitPipeline(false);
            WorkflowRun b = pipeline.waitForStart();
            waitForStepToWait(b);
        }
    });
    story.addStep(new Statement() {

        @Override
        public void evaluate() throws Throwable {
            WorkflowJob p = story.j.jenkins.getItemByFullName(JOB_NAME, WorkflowJob.class);
            WorkflowRun b = p.getLastBuild();
            submitWebHook(FAKE_TASK_ID, "SUCCESS", "OK", b);
            story.j.assertBuildStatusSuccess(story.j.waitForCompletion(b));
        }
    });
}
Also used : QueueTaskFuture(hudson.model.queue.QueueTaskFuture) Statement(org.junit.runners.model.Statement) WorkflowJob(org.jenkinsci.plugins.workflow.job.WorkflowJob) WorkflowRun(org.jenkinsci.plugins.workflow.job.WorkflowRun) Test(org.junit.Test)

Example 2 with QueueTaskFuture

use of hudson.model.queue.QueueTaskFuture in project sonar-scanner-jenkins by SonarSource.

the class WaitForQualityGateStepTest method waitForQualityGateOk_recheck_ws_on_restart.

@Test
public void waitForQualityGateOk_recheck_ws_on_restart() {
    story.addStep(new Statement() {

        @Override
        public void evaluate() throws Throwable {
            handler.status = "PENDING";
            QueueTaskFuture<WorkflowRun> pipeline = submitPipeline(false);
            WorkflowRun b = pipeline.waitForStart();
            waitForStepToWait(b);
            handler.status = "SUCCESS";
            handler.analysisId = FAKE_ANALYSIS_ID;
            handler.qgStatus = "OK";
        }
    });
    story.addStep(new Statement() {

        @Override
        public void evaluate() throws Throwable {
            WorkflowJob p = story.j.jenkins.getItemByFullName(JOB_NAME, WorkflowJob.class);
            WorkflowRun b = p.getLastBuild();
            story.j.assertBuildStatusSuccess(story.j.waitForCompletion(b));
        }
    });
}
Also used : QueueTaskFuture(hudson.model.queue.QueueTaskFuture) Statement(org.junit.runners.model.Statement) WorkflowJob(org.jenkinsci.plugins.workflow.job.WorkflowJob) WorkflowRun(org.jenkinsci.plugins.workflow.job.WorkflowRun) Test(org.junit.Test)

Aggregations

QueueTaskFuture (hudson.model.queue.QueueTaskFuture)2 WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob)2 WorkflowRun (org.jenkinsci.plugins.workflow.job.WorkflowRun)2 Test (org.junit.Test)2 Statement (org.junit.runners.model.Statement)2