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

Improve verification of the running test cluster #9639

Merged
merged 1 commit into from
Feb 6, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface KubeCluster {
KubeCmdClient defaultCmdClient();

default KubeClient defaultClient() {
return new KubeClient(new KubernetesClientBuilder().withConfig(CONFIG).build().adapt(OpenShiftClient.class), "myproject");
return new KubeClient(new KubernetesClientBuilder().withConfig(CONFIG).build().adapt(OpenShiftClient.class), "default");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public boolean isAvailable() {
public boolean isClusterUp() {
List<String> cmd = Arrays.asList(CMD, "cluster-info");
try {
return Exec.exec(cmd).exitStatus() && !Exec.exec(CMD, "api-resources").out().contains("openshift.io");
return Exec.exec(cmd).exitStatus() && !Exec.exec(CMD, "api-versions").out().contains("openshift.io");
} catch (KubeClusterException e) {
LOGGER.debug("'" + String.join(" ", cmd) + "' failed. Please double check connectivity to your cluster!");
LOGGER.debug(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public boolean isAvailable() {
public boolean isClusterUp() {
List<String> cmd = Arrays.asList(CMD, "cluster-info");
try {
return Exec.exec(cmd).exitStatus() && Exec.exec(CMD, "api-resources").out().contains("openshift.io");
return Exec.exec(cmd).exitStatus() && Exec.exec(CMD, "api-versions").out().contains("openshift.io");
} catch (KubeClusterException e) {
LOGGER.debug("'" + String.join(" ", cmd) + "' failed. Please double check connectivity to your cluster!");
LOGGER.debug(e);
Expand Down
4 changes: 2 additions & 2 deletions test/src/main/java/io/strimzi/test/k8s/cluster/Minikube.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public boolean isAvailable() {

@Override
public boolean isClusterUp() {
List<String> cmd = Arrays.asList(CMD, "status");
List<String> cmd = Arrays.asList("kubectl", "get", "nodes", "-o", "jsonpath='{.items[*].metadata.labels}'");
try {
return Exec.exec(cmd).exitStatus();
return Exec.exec(cmd).out().contains("minikube.k8s.io");
} catch (KubeClusterException e) {
LOGGER.debug("'" + String.join(" ", cmd) + "' failed. Please double check connectivity to your cluster!");
LOGGER.debug(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public boolean isAvailable() {
public boolean isClusterUp() {
List<String> cmd = Arrays.asList(CMD, "status", "-n", DEFAULT_NAMESPACE);
try {
return Exec.exec(cmd).exitStatus() && Exec.exec(CMD, "api-resources").out().contains("openshift.io");
return Exec.exec(cmd).exitStatus() && Exec.exec(CMD, "api-versions").out().contains("openshift.io");
} catch (KubeClusterException e) {
LOGGER.debug("'" + String.join(" ", cmd) + "' failed. Please double check connectivity to your cluster!");
LOGGER.debug(e);
Expand Down