Skip to content

Commit

Permalink
Do no build fabric8 builders during test execution
Browse files Browse the repository at this point in the history
  • Loading branch information
kornys committed Nov 9, 2023
1 parent fae65d2 commit 72e4dbe
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 43 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,4 @@ jobs:
${{ runner.os }}-maven-
- name: Validate with Maven
env:
MAVEN_OPTS: "-Xmx6144m"
run: mvn install
run: mvn test
1 change: 1 addition & 0 deletions .mvn/maven.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--no-transfer-progress
95 changes: 62 additions & 33 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.opendatahub</groupId>
<groupId>io.odh</groupId>
<artifactId>odh-e2e</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<it.skip>true</it.skip>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<fabric8.version>6.9.2</fabric8.version>
<sundrio.version>0.101.3</sundrio.version>
<lobbok.version>1.18.30</lobbok.version>
<maven.compiler.version>3.11.0</maven.compiler.version>
<junit.jupiter.version>5.8.2</junit.jupiter.version>
<junit.platform.version>1.8.2</junit.platform.version>
<maven.surefire.version>3.2.2</maven.surefire.version>
</properties>

<dependencies>
Expand All @@ -34,51 +37,77 @@
<version>${fabric8.version}</version>
</dependency>
<dependency>
<groupId>io.sundr</groupId>
<artifactId>builder-annotations</artifactId>
<version>${sundrio.version}</version>
<scope>provided</scope>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-server-mock</artifactId>
<version>${fabric8.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-engine</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lobbok.version}</version>
<scope>provided</scope>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven.surefire.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>java-generator-maven-plugin</artifactId>
<version>${fabric8.version}</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven.surefire.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
<goal>verify</goal>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- Workaround for: https://github.com/fabric8io/kubernetes-client/issues/5580 -->
<source>src/main/resources/crds/odh-manifests-data-science-pipelines-operator-crd.yaml</source>
<urls>
https://raw.githubusercontent.com/ExcelentProject/sokar/main/open-data-hub/install/crds.yaml,
https://raw.githubusercontent.com/ExcelentProject/sokar/main/open-data-hub/client/odh-manifests-codeflare-crd.yaml,
https://raw.githubusercontent.com/ExcelentProject/sokar/main/open-data-hub/client/odh-manifests-dashboard-crd.yaml,
<!-- https://raw.githubusercontent.com/ExcelentProject/sokar/main/open-data-hub/client/odh-manifests-data-science-pipelines-operator-crd.yaml, -->
https://raw.githubusercontent.com/ExcelentProject/sokar/main/open-data-hub/client/odh-manifests-kserve-crd.yaml,
https://raw.githubusercontent.com/ExcelentProject/sokar/main/open-data-hub/client/odh-manifests-model-mesh-crd.yaml,
https://raw.githubusercontent.com/ExcelentProject/sokar/main/open-data-hub/client/odh-manifests-model-mesh-overlays-odh-crd.yaml,
https://raw.githubusercontent.com/ExcelentProject/sokar/main/open-data-hub/client/odh-manifests-odh-model-controller-crd.yaml,
https://raw.githubusercontent.com/ExcelentProject/sokar/main/open-data-hub/client/odh-manifests-odh-notebook-controller-kf-notebook-controller-crd.yaml,
https://raw.githubusercontent.com/ExcelentProject/sokar/main/open-data-hub/client/odh-manifests-ray-crd.yaml,
https://raw.githubusercontent.com/ExcelentProject/sokar/main/open-data-hub/client/odh-manifests-trustyai-service-operator-crd.yaml
</urls>
<extraAnnotations>true</extraAnnotations>
<alwaysPreserveUnknown>true</alwaysPreserveUnknown>
<forkCount>0</forkCount>
<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory" />
<includes>
<include>**/IT*.java</include>
<include>**/*IT.java</include>
<include>**/ST*.java</include>
<include>**/*ST.java</include>
</includes>
<skipITs>${it.skip}</skipITs>
<skipTests>${it.skip}</skipTests>
</configuration>
</plugin>
</plugins>
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/io/odh/test/TestConstants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.odh.test;

public class TestConstants {
public static final String test = "test";
}
7 changes: 0 additions & 7 deletions src/main/java/io/opendatahub/Main.java

This file was deleted.

4 changes: 4 additions & 0 deletions src/test/java/io/odh/test/e2e/TestBase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package io.odh.test.e2e;

public class TestBase {
}
23 changes: 23 additions & 0 deletions src/test/java/io/odh/test/unit/UnitTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.odh.test.unit;

import io.fabric8.kubernetes.api.model.PodBuilder;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient;
import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;
import org.junit.jupiter.api.Test;

import java.util.Collections;
import java.util.Map;

@EnableKubernetesMockClient(crud = true)
public class UnitTests {
private KubernetesClient kubernetesClient;
private KubernetesMockServer server;

@Test
void test() {
Map<String, String> matchLabel = Collections.singletonMap("foo", "bar");
kubernetesClient.pods().resource(new PodBuilder().withNewMetadata().withName("test").withNamespace("test").endMetadata().build()).create();

}
}

0 comments on commit 72e4dbe

Please sign in to comment.