Search in sources :

Example 1 with HistoryEntry

use of com.epam.pipeline.entity.docker.HistoryEntry in project cloud-pipeline by epam.

the class DockerDateUtilsTest method shouldCalculateLatestAndEarliestDateTimeProperly.

@Test
public void shouldCalculateLatestAndEarliestDateTimeProperly() {
    HistoryEntry entryWithEarliestDate = new HistoryEntry();
    entryWithEarliestDate.setV1Compatibility(EARLIEST_DATE);
    HistoryEntry entryWithLatestDate = new HistoryEntry();
    entryWithLatestDate.setV1Compatibility(LATEST_DATE);
    HistoryEntry entryWithShortDate = new HistoryEntry();
    entryWithShortDate.setV1Compatibility(SHORT_DATE);
    RawImageDescription description = new RawImageDescription();
    description.setHistory(Arrays.asList(entryWithEarliestDate, entryWithLatestDate, entryWithShortDate));
    assertThat(DockerDateUtils.getEarliestDate(description).toInstant().atZone(ZoneOffset.UTC).getMinute()).isEqualTo(EARLIEST_MINUTES);
    assertThat(DockerDateUtils.getLatestDate(description).toInstant().atZone(ZoneOffset.UTC).getMinute()).isEqualTo(LATEST_MINUTES);
}
Also used : RawImageDescription(com.epam.pipeline.entity.docker.RawImageDescription) HistoryEntry(com.epam.pipeline.entity.docker.HistoryEntry) Test(org.junit.Test)

Aggregations

HistoryEntry (com.epam.pipeline.entity.docker.HistoryEntry)1 RawImageDescription (com.epam.pipeline.entity.docker.RawImageDescription)1 Test (org.junit.Test)1