Skip to content

Commit

Permalink
ISSUE-160: fix(test/utils): migrate from java.util.Date to `java.ti…
Browse files Browse the repository at this point in the history
…me.Instant` to resolve fabric8 crash (#161)
  • Loading branch information
jiridanek authored Oct 17, 2024
1 parent b719c0e commit 1330deb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main/java/io/odh/test/TestConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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() {
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/odh/test/utils/UpgradeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/io/odh/test/e2e/upgrade/BundleUpgradeST.java
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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, () -> { });
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/io/odh/test/e2e/upgrade/OlmUpgradeST.java
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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, () -> { });
Expand Down

0 comments on commit 1330deb

Please sign in to comment.