Search in sources :

Example 6 with BuildStatus

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);
}
Also used : BuildConfiguration(org.jboss.pnc.dto.BuildConfiguration) GroupBuild(org.jboss.pnc.dto.GroupBuild) Build(org.jboss.pnc.dto.Build) BuildStatus(org.jboss.pnc.enums.BuildStatus) BuildsFilterParameters(org.jboss.pnc.rest.api.parameters.BuildsFilterParameters) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 7 with BuildStatus

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);
}
Also used : GroupBuild(org.jboss.pnc.dto.GroupBuild) BuildStatus(org.jboss.pnc.enums.BuildStatus) GroupBuildParameters(org.jboss.pnc.rest.api.parameters.GroupBuildParameters) GroupConfiguration(org.jboss.pnc.dto.GroupConfiguration) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 8 with BuildStatus

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);
}
Also used : GroupBuild(org.jboss.pnc.dto.GroupBuild) BuildStatus(org.jboss.pnc.enums.BuildStatus) GroupBuildParameters(org.jboss.pnc.rest.api.parameters.GroupBuildParameters) GroupConfiguration(org.jboss.pnc.dto.GroupConfiguration) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 9 with BuildStatus

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());
}
Also used : BuildConfiguration(org.jboss.pnc.dto.BuildConfiguration) GroupBuild(org.jboss.pnc.dto.GroupBuild) Build(org.jboss.pnc.dto.Build) BuildStatus(org.jboss.pnc.enums.BuildStatus) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 10 with BuildStatus

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);
}
Also used : BuildConfiguration(org.jboss.pnc.dto.BuildConfiguration) GroupBuild(org.jboss.pnc.dto.GroupBuild) Build(org.jboss.pnc.dto.Build) BuildStatus(org.jboss.pnc.enums.BuildStatus) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Aggregations

BuildStatus (org.jboss.pnc.enums.BuildStatus)20 Test (org.junit.Test)14 GroupBuild (org.jboss.pnc.dto.GroupBuild)10 ContainerTest (org.jboss.pnc.test.category.ContainerTest)10 Build (org.jboss.pnc.dto.Build)9 BuildConfiguration (org.jboss.pnc.dto.BuildConfiguration)7 Instant (java.time.Instant)4 GroupConfiguration (org.jboss.pnc.dto.GroupConfiguration)3 DatastoreMock (org.jboss.pnc.mock.datastore.DatastoreMock)3 GroupBuildParameters (org.jboss.pnc.rest.api.parameters.GroupBuildParameters)3 BuildDriverResult (org.jboss.pnc.spi.builddriver.BuildDriverResult)3 Consumer (java.util.function.Consumer)2 DatastoreAdapter (org.jboss.pnc.coordinator.builder.datastore.DatastoreAdapter)2 BuildCoordinationStatus (org.jboss.pnc.enums.BuildCoordinationStatus)2 TestProjectConfigurationBuilder (org.jboss.pnc.mock.model.builders.TestProjectConfigurationBuilder)2 BuildRecord (org.jboss.pnc.model.BuildRecord)2 CompletionStatus (org.jboss.pnc.spi.coordinator.CompletionStatus)2 Logger (org.slf4j.Logger)2 LoggerFactory (org.slf4j.LoggerFactory)2 ArrayList (java.util.ArrayList)1