use of org.jboss.pnc.enums.BuildStatus in project pnc by project-ncl.
the class BuildTest method shouldTriggerBuildWithADependencyAndFinishWithoutProblems.
@Test
public void shouldTriggerBuildWithADependencyAndFinishWithoutProblems() throws ClientException {
// given - A BC with a dependency on pnc-1.0.0.DR1
BuildConfiguration buildConfigurationParent = buildConfigurationClient.getAll(Optional.empty(), Optional.of("name==dependency-analysis-1.3")).iterator().next();
// Update dependency
BuildConfiguration buildConfigurationChild = buildConfigurationClient.getAll(Optional.empty(), Optional.of("name==pnc-1.0.0.DR1")).iterator().next();
BuildConfiguration updatedBuildConfigurationChild = buildConfigurationChild.toBuilder().description(buildConfigurationChild.getDescription() + ".").build();
buildConfigurationClient.update(buildConfigurationChild.getId(), updatedBuildConfigurationChild);
// The update of the description should not have changed the lastModificationDate
assertThat(buildConfigurationChild.getModificationTime()).isEqualTo(updatedBuildConfigurationChild.getModificationTime());
// when
Build build = buildConfigurationClient.trigger(buildConfigurationParent.getId(), getBuildParameters(false, true));
BuildsFilterParameters parameters = new BuildsFilterParameters();
parameters.setRunning(true);
RemoteCollection<Build> childBuildCol = buildConfigurationClient.getBuilds(buildConfigurationChild.getId(), parameters);
Build childBuild = childBuildCol.getAll().iterator().next();
// then
assertThat(childBuildCol.size()).isEqualTo(1);
assertThat(buildConfigurationParent.getDependencies().size()).isEqualTo(1);
assertThat(build).isNotNull().extracting("id").isNotNull().isNotEqualTo("");
EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.SUCCESS);
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(build.getId(), isIn, null), 15, TimeUnit.SECONDS);
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(childBuild.getId(), isIn, null), 15, TimeUnit.SECONDS);
}
use of org.jboss.pnc.enums.BuildStatus in project pnc by project-ncl.
the class BuildTest method shouldTriggerGroupBuildAndFinishWithoutProblems.
@Test
public void shouldTriggerGroupBuildAndFinishWithoutProblems() throws ClientException {
// given
GroupConfiguration groupConfig = groupConfigurationClient.getAll().iterator().next();
// when
GroupBuildParameters groupBuildParameters = new GroupBuildParameters();
groupBuildParameters.setRebuildMode(RebuildMode.FORCE);
GroupBuild groupBuild = groupConfigurationClient.trigger(groupConfig.getId(), groupBuildParameters, GroupBuildRequest.builder().buildConfigurationRevisions(new ArrayList<>()).build());
assertThat(groupBuild).isNotNull().extracting("id").isNotNull().isNotEqualTo("");
// then
EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.SUCCESS);
EnumSet<BuildStatus> isNotIn = EnumSet.of(BuildStatus.REJECTED);
ResponseUtils.waitSynchronouslyFor(() -> groupBuildToFinish(groupBuild.getId(), isIn, isNotIn), 15, TimeUnit.SECONDS);
}
use of org.jboss.pnc.enums.BuildStatus in project pnc by project-ncl.
the class BuildTest method shouldRejectGroupBuildWithNoRebuildsRequired.
@Test
public void shouldRejectGroupBuildWithNoRebuildsRequired() throws ClientException {
// given
GroupConfiguration groupConfig = groupConfigurationClient.getAll().iterator().next();
// and after one build is done
GroupBuildParameters groupBuildParameters = new GroupBuildParameters();
groupBuildParameters.setRebuildMode(RebuildMode.FORCE);
GroupBuild groupBuild1 = groupConfigurationClient.trigger(groupConfig.getId(), groupBuildParameters, GroupBuildRequest.builder().buildConfigurationRevisions(new ArrayList<>()).build());
assertThat(groupBuild1).isNotNull().extracting("id").isNotNull().isNotEqualTo("");
ResponseUtils.waitSynchronouslyFor(() -> groupBuildToFinish(groupBuild1.getId(), EnumSet.of(BuildStatus.SUCCESS), null), 15, TimeUnit.SECONDS);
// when next build is triggered
GroupBuild groupBuild2 = groupConfigurationClient.trigger(groupConfig.getId(), new GroupBuildParameters(), GroupBuildRequest.builder().buildConfigurationRevisions(new ArrayList<>()).build());
// then
EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.NO_REBUILD_REQUIRED);
EnumSet<BuildStatus> isNotIn = EnumSet.of(BuildStatus.SUCCESS, BuildStatus.REJECTED);
ResponseUtils.waitSynchronouslyFor(() -> groupBuildToFinish(groupBuild2.getId(), isIn, isNotIn), 15, TimeUnit.SECONDS);
}
use of org.jboss.pnc.enums.BuildStatus in project pnc by project-ncl.
the class BuildTest method shouldHaveNoRebuildCauseFilled.
@Test
public void shouldHaveNoRebuildCauseFilled() throws Exception {
// with
BuildConfiguration buildConfiguration = buildConfigurationClient.getAll().iterator().next();
// when #1
Build build = buildConfigurationClient.trigger(buildConfiguration.getId(), getPersistentParameters(true));
assertThat(build).isNotNull().extracting("id").isNotNull().isNotEqualTo("");
EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.SUCCESS);
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(build.getId(), isIn, null), 15, TimeUnit.SECONDS);
// when #2
EnumSet<BuildStatus> isNotIn = EnumSet.of(BuildStatus.SUCCESS, BuildStatus.FAILED);
Build rebuild = buildConfigurationClient.trigger(buildConfiguration.getId(), getBuildParameters(false, false));
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(rebuild.getId(), EnumSet.of(BuildStatus.NO_REBUILD_REQUIRED), isNotIn), 15, TimeUnit.SECONDS);
// then
Build refresh = buildClient.getSpecific(rebuild.getId());
assertThat(refresh.getNoRebuildCause()).isNotNull().extracting("id").isEqualTo(build.getId());
}
use of org.jboss.pnc.enums.BuildStatus in project pnc by project-ncl.
the class BuildTest method shouldTriggerBuildAndFinishWithoutProblems.
@Test
public void shouldTriggerBuildAndFinishWithoutProblems() throws ClientException {
// with
BuildConfiguration buildConfiguration = buildConfigurationClient.getAll().iterator().next();
// when
Build build = buildConfigurationClient.trigger(buildConfiguration.getId(), getPersistentParameters(true));
assertThat(build).isNotNull().extracting("id").isNotNull().isNotEqualTo("");
EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.SUCCESS);
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(build.getId(), isIn, null), 15, TimeUnit.SECONDS);
}
Aggregations