Skip to content

Commit

Permalink
test(crd-generator): extract approval tests to independent module
Browse files Browse the repository at this point in the history
Initial step to allow for multiple API implementations

Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa authored May 7, 2024
1 parent c90383e commit 6eec326
Show file tree
Hide file tree
Showing 88 changed files with 139 additions and 61 deletions.
3 changes: 2 additions & 1 deletion crd-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
<name>Fabric8 :: CRD generator :: Parent</name>

<modules>
<module>apt</module>
<module>api</module>
<module>api-v2</module>
<module>apt</module>
<module>test</module>
<module>test-apt</module>
</modules>
</project>
126 changes: 126 additions & 0 deletions crd-generator/test-apt/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2015 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>crd-generator-parent</artifactId>
<groupId>io.fabric8</groupId>
<version>6.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>crd-generator-test-apt</artifactId>
<name>Fabric8 :: CRD generator :: Tests (APT)</name>

<properties>
<skipStaging>true</skipStaging>
</properties>

<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>crd-generator-apt</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.approvaltests</groupId>
<artifactId>approvaltests</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<scope>test</scope>
</dependency>

<!-- Keycloak model for testing -->
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-core</artifactId>
<version>${keycloak.version}</version>
<scope>test</scope>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<classpathScope>test</classpathScope>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-Aio.fabric8.crd.generator.parallel=false</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>
66 changes: 9 additions & 57 deletions crd-generator/test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>crd-generator-parent</artifactId>
<groupId>io.fabric8</groupId>
Expand All @@ -30,91 +30,43 @@
<name>Fabric8 :: CRD generator :: Tests</name>

<properties>
<keycloak-version>24.0.3</keycloak-version>
<skipStaging>true</skipStaging>
</properties>

<dependencies>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>crd-generator-apt</artifactId>
<artifactId>crd-generator-api</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>test</scope>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<groupId>com.approvaltests</groupId>
<artifactId>approvaltests</artifactId>
<scope>test</scope>
</dependency>

<!-- Keycloak model for testing -->
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-core</artifactId>
<version>${keycloak-version}</version>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<scope>test</scope>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<classpathScope>test</classpathScope>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-Aio.fabric8.crd.generator.parallel=false</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>
5 changes: 2 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
<assertj.core.version>3.25.3</assertj.core.version>
<awaitility.version>4.2.1</awaitility.version>
<approvaltests.version>23.1.0</approvaltests.version>
<keycloak.version>24.0.3</keycloak.version><!-- Used by CRD Generator integration tests for verifications -->
<mockito.version>4.11.0</mockito.version>
<mockito-inline.version>5.2.0</mockito-inline.version>
<spock.version>2.4-M4-groovy-4.0</spock.version>
Expand Down Expand Up @@ -140,7 +141,6 @@
<properties.maven.plugin.version>1.0.0</properties.maven.plugin.version>
<kubernetes.webhooks.framework.version>1.1.3</kubernetes.webhooks.framework.version>


<!-- Maven plugin versions -->
<buildnumber.plugin.version>3.2.0</buildnumber.plugin.version>
<exec.maven-plugin.version>3.2.0</exec.maven-plugin.version>
Expand Down Expand Up @@ -176,7 +176,6 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<skipTests>false</skipTests>
<svc.version>1.1.1</svc.version>
<generate.targetDirectory>${project.basedir}/src/generated/java</generate.targetDirectory>

<exec.master>https://localhost:8443</exec.master>
Expand Down Expand Up @@ -1256,7 +1255,7 @@
<exclude>kubernetes-client/src/test/resources/mockito-extensions/*</exclude>
<exclude>**/src/test/resources/ssl/*</exclude>
<exclude>**/src/test/resources/io/fabric8/java/generator/approvals/*.*.approved.txt</exclude>
<exclude>crd-generator/api/src/test/resources/**/*.approved.txt</exclude>
<exclude>crd-generator/**/src/test/resources/**/*.approved.txt</exclude>
<exclude>**/it/**/expected/**/*.expected</exclude>
<exclude>Jenkinsfile</exclude>
<exclude>.mvn/**/*</exclude>
Expand Down

0 comments on commit 6eec326

Please sign in to comment.