use of org.jboss.pnc.enums.BuildStatus in project pnc by project-ncl.
the class DatastoreAdapterTest method shouldStoreRepositoryManagerSuccessResult.
@Test
public void shouldStoreRepositoryManagerSuccessResult() throws DatastoreException {
// given
DatastoreMock datastore = new DatastoreMock();
DatastoreAdapter datastoreAdapter = new DatastoreAdapter(datastore);
BuildStatus buildStatus = BuildStatus.SUCCESS;
CompletionStatus completionStatus = CompletionStatus.SUCCESS;
// when
storeResult(datastoreAdapter, buildStatus, completionStatus);
// then
List<BuildRecord> buildRecords = datastore.getBuildRecords();
Assert.assertEquals(1, buildRecords.size());
BuildRecord buildRecord = buildRecords.get(0);
Assert.assertEquals(buildRecord.getStatus(), BuildStatus.SUCCESS);
Assert.assertTrue(buildRecord.getBuildLog().contains(BUILD_LOG));
Assert.assertTrue(buildRecord.getBuildLog().contains(REPOSITORY_MANAGER_LOG));
}
use of org.jboss.pnc.enums.BuildStatus in project pnc by project-ncl.
the class BuildTest method shouldTriggerGroupBuildWithBCInRevisionAndFinishWithoutProblems.
@Test
public void shouldTriggerGroupBuildWithBCInRevisionAndFinishWithoutProblems() throws ClientException {
// given
GroupConfiguration groupConfiguration = groupConfigurationClient.getAll().iterator().next();
assertThat(groupConfiguration.getBuildConfigs()).isNotEmpty();
List<BuildConfigurationRevisionRef> buildConfigurationRevisions = new ArrayList<>();
BuildConfigurationRevision buildConfigurationRevision = BuildConfigurationRevision.builder().id(groupConfiguration.getBuildConfigs().keySet().iterator().next()).rev(1).name(groupConfiguration.getName()).build();
buildConfigurationRevisions.add(buildConfigurationRevision);
GroupBuildRequest groupConfigWithAuditedBCsRest = GroupBuildRequest.builder().buildConfigurationRevisions(buildConfigurationRevisions).build();
GroupBuildParameters groupBuildParameters = new GroupBuildParameters();
groupBuildParameters.setRebuildMode(RebuildMode.FORCE);
// when
GroupBuild groupBuild = groupConfigurationClient.trigger(groupConfiguration.getId(), groupBuildParameters, groupConfigWithAuditedBCsRest);
// then
assertThat(groupBuild).isNotNull().extracting("id").isNotNull().isNotEqualTo("");
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 shouldNotTriggerANewPersistentBuildWithoutForceIfOnlyDescriptionChanged.
@Test
public void shouldNotTriggerANewPersistentBuildWithoutForceIfOnlyDescriptionChanged() throws ClientException {
BuildConfiguration buildConfiguration = buildConfigurationClient.getAll(Optional.empty(), Optional.of("name==maven-plugin-test")).iterator().next();
EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.SUCCESS);
EnumSet<BuildStatus> isNotIn = EnumSet.of(BuildStatus.REJECTED, BuildStatus.NO_REBUILD_REQUIRED);
// Build persistent builds (parent and dependency) on new revision
Build persistentBuild = buildConfigurationClient.trigger(buildConfiguration.getId(), getPersistentParameters(true));
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(persistentBuild.getId(), isIn, isNotIn), 15, TimeUnit.SECONDS);
// Updating the description only won't create a new revision, as description is not audited anymore
Instant oldLastModDate = buildConfiguration.getModificationTime();
BuildConfiguration updatedConfiguration = buildConfiguration.toBuilder().description("Random Description to be able to trigger build again so that persistent build will be first on this revision").build();
buildConfigurationClient.update(updatedConfiguration.getId(), updatedConfiguration);
assertThat(oldLastModDate).isEqualTo(updatedConfiguration.getModificationTime());
Build build2 = buildConfigurationClient.trigger(updatedConfiguration.getId(), getPersistentParameters());
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(build2.getId(), EnumSet.of(BuildStatus.NO_REBUILD_REQUIRED), null), 15, TimeUnit.SECONDS);
}
use of org.jboss.pnc.enums.BuildStatus in project pnc by project-ncl.
the class BuildTest method shouldNotTriggerANewTemporaryBuildWithoutForceIfOnlyDescriptionChanged.
@Test
public void shouldNotTriggerANewTemporaryBuildWithoutForceIfOnlyDescriptionChanged() throws ClientException {
BuildConfiguration buildConfiguration = buildConfigurationClient.getAll(Optional.empty(), Optional.of("name==maven-plugin-test")).iterator().next();
EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.SUCCESS);
EnumSet<BuildStatus> isNotIn = EnumSet.of(BuildStatus.REJECTED, BuildStatus.NO_REBUILD_REQUIRED);
// Build temporary builds (parent and dependency) on new revision
Build persistentBuild = buildConfigurationClient.trigger(buildConfiguration.getId(), getTemporaryParameters(true));
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(persistentBuild.getId(), isIn, isNotIn), 15, TimeUnit.SECONDS);
// Updating the description only won't create a new revision, as description is not audited anymore
Instant oldLastModDate = buildConfiguration.getModificationTime();
BuildConfiguration updatedConfiguration = buildConfiguration.toBuilder().description("Random Description to be able to trigger build again so that temporary build will be first on this revision").build();
buildConfigurationClient.update(updatedConfiguration.getId(), updatedConfiguration);
assertThat(oldLastModDate).isEqualTo(updatedConfiguration.getModificationTime());
Build build2 = buildConfigurationClient.trigger(updatedConfiguration.getId(), getTemporaryParameters());
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(build2.getId(), EnumSet.of(BuildStatus.NO_REBUILD_REQUIRED), null), 15, TimeUnit.SECONDS);
}
use of org.jboss.pnc.enums.BuildStatus in project pnc by project-ncl.
the class BuildTest method shouldTriggerPersistentWithoutForceAfterTemporaryOnTheSameRev.
@Test
public void shouldTriggerPersistentWithoutForceAfterTemporaryOnTheSameRev() throws ClientException {
BuildConfiguration buildConfiguration = buildConfigurationClient.getAll(Optional.empty(), Optional.of("name==maven-plugin-test")).iterator().next();
// Updating the description only won't create a new revision, as description is not audited anymore
Instant oldLastModDate = buildConfiguration.getModificationTime();
BuildConfiguration updatedConfiguration = buildConfiguration.toBuilder().description("Random Description to be able to trigger build again so that temporary build will be first on this revision").buildScript("mvn" + " clean deploy -DskipTests=true").build();
buildConfigurationClient.update(updatedConfiguration.getId(), updatedConfiguration);
updatedConfiguration = buildConfigurationClient.getSpecific(updatedConfiguration.getId());
assertThat(oldLastModDate).isNotEqualTo(updatedConfiguration.getModificationTime());
EnumSet<BuildStatus> isIn = EnumSet.of(BuildStatus.SUCCESS);
EnumSet<BuildStatus> isNotIn = EnumSet.of(BuildStatus.REJECTED, BuildStatus.NO_REBUILD_REQUIRED);
Build build = buildConfigurationClient.trigger(buildConfiguration.getId(), getTemporaryParameters());
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(build.getId(), isIn, isNotIn), 15, TimeUnit.SECONDS);
Build afterTempPersistentBuild = buildConfigurationClient.trigger(buildConfiguration.getId(), getPersistentParameters());
ResponseUtils.waitSynchronouslyFor(() -> buildToFinish(afterTempPersistentBuild.getId(), isIn, isNotIn), 15, TimeUnit.SECONDS);
}
Aggregations