diff --git a/src/main/java/io/odh/test/TestConstants.java b/src/main/java/io/odh/test/TestConstants.java index c25ba54..5074617 100644 --- a/src/main/java/io/odh/test/TestConstants.java +++ b/src/main/java/io/odh/test/TestConstants.java @@ -4,8 +4,8 @@ */ package io.odh.test; -import java.text.SimpleDateFormat; import java.time.Duration; +import java.time.format.DateTimeFormatter; public class TestConstants { public static final String DEFAULT_NAMESPACE = "default"; @@ -35,7 +35,7 @@ public class TestConstants { public static final String CHANNEL_STABLE = "stable"; public static final String CHANNEL_LATEST = "latest"; - public static final SimpleDateFormat TIMESTAMP_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); + public static final DateTimeFormatter TIMESTAMP_DATE_FORMAT = DateTimeFormatter.ISO_INSTANT; private TestConstants() { } diff --git a/src/main/java/io/odh/test/utils/UpgradeUtils.java b/src/main/java/io/odh/test/utils/UpgradeUtils.java index 23446bb..03c1a4f 100644 --- a/src/main/java/io/odh/test/utils/UpgradeUtils.java +++ b/src/main/java/io/odh/test/utils/UpgradeUtils.java @@ -7,14 +7,14 @@ import io.odh.test.TestConstants; import io.skodjob.testframe.resources.KubeResourceManager; -import java.util.Date; +import java.time.Instant; import static io.odh.test.framework.matchers.Matchers.logHasNoUnexpectedErrors; import static org.hamcrest.MatcherAssert.assertThat; public class UpgradeUtils { - public static void deploymentLogIsErrorEmpty(String namespace, String deploymentName, Date sinceTimestamp) { + public static void deploymentLogIsErrorEmpty(String namespace, String deploymentName, Instant sinceTimestamp) { // Check that operator doesn't contain errors in logs since sec String operatorLog = KubeResourceManager.getKubeClient().getClient().apps().deployments() .inNamespace(namespace).withName(deploymentName).sinceTime(TestConstants.TIMESTAMP_DATE_FORMAT.format(sinceTimestamp)).getLog(); diff --git a/src/test/java/io/odh/test/e2e/upgrade/BundleUpgradeST.java b/src/test/java/io/odh/test/e2e/upgrade/BundleUpgradeST.java index c76b0d8..ce34c48 100644 --- a/src/test/java/io/odh/test/e2e/upgrade/BundleUpgradeST.java +++ b/src/test/java/io/odh/test/e2e/upgrade/BundleUpgradeST.java @@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; -import java.util.Date; +import java.time.Instant; import java.util.Map; @SuiteDoc( @@ -107,7 +107,7 @@ void testUpgradeBundle() throws IOException { LabelSelector labelSelector = KubeResourceManager.getKubeClient().getClient().apps().deployments() .inNamespace(OdhConstants.CONTROLLERS_NAMESPACE).withName(OdhConstants.DASHBOARD_CONTROLLER).get().getSpec().getSelector(); PodUtils.verifyThatPodsAreStable(OdhConstants.CONTROLLERS_NAMESPACE, labelSelector); - Date operatorLogCheckTimestamp = new Date(); + Instant operatorLogCheckTimestamp = Instant.now(); // Verify that NTB pods are stable PodUtils.waitForPodsReady(ntbNamespace, lblSelector, 1, true, () -> { }); diff --git a/src/test/java/io/odh/test/e2e/upgrade/OlmUpgradeST.java b/src/test/java/io/odh/test/e2e/upgrade/OlmUpgradeST.java index d7326c4..8623e45 100644 --- a/src/test/java/io/odh/test/e2e/upgrade/OlmUpgradeST.java +++ b/src/test/java/io/odh/test/e2e/upgrade/OlmUpgradeST.java @@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; -import java.util.Date; +import java.time.Instant; import java.util.Map; @SuiteDoc( @@ -110,7 +110,7 @@ void testUpgradeOlm() throws IOException, InterruptedException { LabelSelector labelSelector = KubeResourceManager.getKubeClient().getClient() .apps().deployments().inNamespace(OdhConstants.CONTROLLERS_NAMESPACE).withName(OdhConstants.DASHBOARD_CONTROLLER).get().getSpec().getSelector(); PodUtils.verifyThatPodsAreStable(OdhConstants.CONTROLLERS_NAMESPACE, labelSelector); - Date operatorLogCheckTimestamp = new Date(); + Instant operatorLogCheckTimestamp = Instant.now(); // Verify that NTB pods are stable PodUtils.waitForPodsReady(ntbNamespace, lblSelector, 1, true, () -> { });