Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE-160: fix(test/utils): migrate from java.util.Date to java.time.Instant to resolve fabric8 crash #161

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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