-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add module with tests and gh workflow
Signed-off-by: David Kornel <[email protected]>
- Loading branch information
Showing
6 changed files
with
242 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Verify | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
verify: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Cache m2 repo | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Create k8s Kind Cluster | ||
uses: helm/kind-action@v1 | ||
|
||
- name: Verify | ||
run: mvn verify -P integration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
<?xml version="1.0" encoding="UTF-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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.skodjob</groupId> | ||
<artifactId>test-frame</artifactId> | ||
<version>0.1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>test-frame-test</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>17</maven.compiler.source> | ||
<maven.compiler.target>17</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
|
||
<junit.jupiter.version>5.10.2</junit.jupiter.version> | ||
<junit.platform.version>1.10.2</junit.platform.version> | ||
<maven.surefire.version>3.2.2</maven.surefire.version> | ||
<fabric8.version>6.10.0</fabric8.version> | ||
|
||
<maven.deploy.skip>true</maven.deploy.skip> | ||
<it.skip>true</it.skip> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.skodjob</groupId> | ||
<artifactId>test-frame-common</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>openshift-client</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-model</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>generator-annotations</artifactId> | ||
</dependency> | ||
<dependency> | ||
<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> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-params</artifactId> | ||
<version>${junit.jupiter.version}</version> | ||
</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.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>${maven.surefire.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>${maven.surefire.version}</version> | ||
<configuration> | ||
<test>io.skodjob.testframe.test.unit.**</test> | ||
<properties> | ||
<configurationParameters> | ||
junit.jupiter.extensions.autodetection.enabled = true | ||
</configurationParameters> | ||
</properties> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>${maven.surefire.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>verify</goal> | ||
<goal>integration-test</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<skipITs>${it.skip}</skipITs> | ||
<forkCount>0</forkCount> | ||
<includes> | ||
<include>io.skodjob.testframe.test.integration.**</include> | ||
</includes> | ||
<properties> | ||
<configurationParameters> | ||
junit.jupiter.extensions.autodetection.enabled = true | ||
</configurationParameters> | ||
</properties> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>none</id> | ||
<properties> | ||
<it.skip>true</it.skip> | ||
</properties> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
</profile> | ||
|
||
<profile> | ||
<id>integration</id> | ||
<properties> | ||
<it.skip>false</it.skip> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
37 changes: 37 additions & 0 deletions
37
test-frame-test/src/test/java/io/skodjob/testframe/test/integration/ResourceManagerIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright Skodjob authors. | ||
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). | ||
*/ | ||
package io.skodjob.testframe.test.integration; | ||
|
||
import io.fabric8.kubernetes.api.model.NamespaceBuilder; | ||
import io.skodjob.testframe.resources.ResourceManager; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestInstance; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
@io.skodjob.testframe.annotations.ResourceManager | ||
@TestInstance(TestInstance.Lifecycle.PER_CLASS) | ||
public class ResourceManagerIT { | ||
|
||
@BeforeAll | ||
void setupAll() { | ||
ResourceManager.getInstance().createResourceWithWait( | ||
new NamespaceBuilder().withNewMetadata().withName("test").endMetadata().build()); | ||
} | ||
|
||
@BeforeEach | ||
void setupEach() { | ||
ResourceManager.getInstance().createResourceWithWait( | ||
new NamespaceBuilder().withNewMetadata().withName("test2").endMetadata().build()); | ||
} | ||
|
||
@Test | ||
void test() { | ||
assertNotNull(ResourceManager.getKubeClient().getClient().namespaces().withName("test").get()); | ||
assertNotNull(ResourceManager.getKubeClient().getClient().namespaces().withName("test2").get()); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
test-frame-test/src/test/java/io/skodjob/testframe/test/unit/UnitTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright Skodjob authors. | ||
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). | ||
*/ | ||
package io.skodjob.testframe.test.unit; | ||
|
||
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; | ||
|
||
@EnableKubernetesMockClient(crud = true) | ||
public class UnitTests { | ||
private KubernetesClient kubernetesClient; | ||
private KubernetesMockServer server; | ||
|
||
@Test | ||
void tmpTest() { | ||
System.out.println("Placeholder for test"); | ||
} | ||
} |