Skip to content

Commit

Permalink
tests: fix/improve services integration tests (redhat-developer#832)
Browse files Browse the repository at this point in the history
Signed-off-by: Stephane Bouchet <[email protected]>
  • Loading branch information
sbouchet authored May 30, 2024
1 parent 21e98e8 commit 73fb0c1
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ public abstract class OdoCliTest extends BasePlatformTestCase {
public static final String COMPONENT_PATH = "src/it/projects/nodejs";

// see https://operatorhub.io/operator/cloud-native-postgresql/ STABLE channel for versions
public static final String SERVICE_TEMPLATE = "cloud-native-postgresql.v1.16.2";
public static final String SERVICE_TEMPLATE = "cloud-native-postgresql";
public static final String SERVICE_KUBE_VERSION = "v1.16.2";
public static final String SERVICE_OPENSHIFT_VERSION = "v1.22.1";

public static final String SERVICE_CRD = "clusters.postgresql.k8s.enterprisedb.io";
public static final String REGISTRY_URL = "https://registry.stage.devfile.io";
public static final String REGISTRY_NAME = "RegistryForITTests";
Expand Down Expand Up @@ -120,10 +123,9 @@ protected OperatorCRD getOperatorCRD(ServiceTemplate serviceTemplate) {
}

protected ServiceTemplate getServiceTemplate() throws IOException {
with().pollDelay(10, TimeUnit.SECONDS).await().atMost(10, TimeUnit.MINUTES).until(() -> !odo.getServiceTemplates().isEmpty());
ServiceTemplate serviceTemplate = odo.getServiceTemplates().stream().filter(s -> s.getName().equals(SERVICE_TEMPLATE)).findFirst().orElse(null);
assertNotNull(serviceTemplate);
return serviceTemplate;
with().pollDelay(10, TimeUnit.SECONDS).await().atMost(5, TimeUnit.MINUTES).until(() -> !odo.getServiceTemplates().isEmpty());
with().pollDelay(10, TimeUnit.SECONDS).await().atMost(5, TimeUnit.MINUTES).until(() -> odo.getServiceTemplates().stream().anyMatch(s -> s.getName().equals(SERVICE_TEMPLATE + "." + (odo.isOpenShift() ? SERVICE_OPENSHIFT_VERSION : SERVICE_KUBE_VERSION))));
return odo.getServiceTemplates().stream().filter(s -> s.getName().equals(SERVICE_TEMPLATE + "." + (odo.isOpenShift() ? SERVICE_OPENSHIFT_VERSION : SERVICE_KUBE_VERSION))).findFirst().orElse(null);
}

protected void createService(String project, ServiceTemplate serviceTemplate, OperatorCRD crd, String service) throws IOException {
Expand Down

0 comments on commit 73fb0c1

Please sign in to comment.