Set offset when checking date in tests

Update integration tests that check the current date so that the offset
is set for the current time before comparing results.

See gh-34786
This commit is contained in:
Phillip Webb
2023-04-12 22:13:08 -07:00
parent 712b88d3a7
commit 9b6a2a59a1
2 changed files with 2 additions and 2 deletions

View File

@@ -322,7 +322,7 @@ class BootBuildImageIntegrationTests {
assertThat(result.getOutput()).contains("---> Test Info buildpack done");
Image image = new DockerApi().image().inspect(ImageReference.of("docker.io/library/" + projectName));
OffsetDateTime createdDateTime = OffsetDateTime.parse(image.getCreated());
OffsetDateTime current = OffsetDateTime.now();
OffsetDateTime current = OffsetDateTime.now().withOffsetSameInstant(createdDateTime.getOffset());
assertThat(createdDateTime.getYear()).isEqualTo(current.getYear());
assertThat(createdDateTime.getMonth()).isEqualTo(current.getMonth());
assertThat(createdDateTime.getDayOfMonth()).isEqualTo(current.getDayOfMonth());