update deployment status checks

This commit is contained in:
Marco Ferrer
2020-10-02 17:12:10 -04:00
parent 15e9ee30ee
commit 04b553cdec
3 changed files with 24 additions and 5 deletions

View File

@@ -175,11 +175,16 @@ public class AppTest extends AbstractGitHubWireMockTest {
.create();
assertNotNull(deployment.getCreator());
assertNotNull(deployment.getId());
List<GHDeployment> deployments = repository.listDeployments(null, "master", null, "unittest").toList();
List<GHDeployment> deployments = repository
.listDeployments(null, "master", null, "unittest")
.toList();
assertNotNull(deployments);
assertFalse(Iterables.isEmpty(deployments));
GHDeployment unitTestDeployment = deployments.get(0);
assertEquals("unittest", unitTestDeployment.getEnvironment());
assertEquals("unittest", unitTestDeployment.getOriginalEnvironment());
assertEquals(false, unitTestDeployment.isProductionEnvironment());
assertEquals(true, unitTestDeployment.isTransientEnvironment());
assertEquals("master", unitTestDeployment.getRef());
}
@@ -191,14 +196,24 @@ public class AppTest extends AbstractGitHubWireMockTest {
.description("question")
.payload("{\"user\":\"atmos\",\"room_id\":123456}")
.create();
GHDeploymentStatus ghDeploymentStatus = deployment.createStatus(GHDeploymentState.SUCCESS)
GHDeploymentStatus ghDeploymentStatus = deployment.createStatus(GHDeploymentState.QUEUED)
.description("success")
.targetUrl("http://www.github.com")
.logUrl("http://www.github.com/logurl")
.environmentUrl("http://www.github.com/envurl")
.environment("new-ci-env")
.create();
Iterable<GHDeploymentStatus> deploymentStatuses = deployment.listStatuses();
assertNotNull(deploymentStatuses);
assertEquals(1, Iterables.size(deploymentStatuses));
assertEquals(ghDeploymentStatus.getId(), Iterables.get(deploymentStatuses, 0).getId());
GHDeploymentStatus actualStatus = Iterables.get(deploymentStatuses, 0);
assertEquals(ghDeploymentStatus.getId(), actualStatus.getId());
assertEquals(ghDeploymentStatus.getState(), actualStatus.getState());
assertEquals(ghDeploymentStatus.getLogUrl(), actualStatus.getLogUrl());
// Target url was deprecated and replaced with log url. The gh api will
// prefer the log url value and return it in target field
assertEquals(ghDeploymentStatus.getTargetUrl(), actualStatus.getLogUrl());
}
@Test