-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Attila Mészáros <[email protected]>
- Loading branch information
Showing
9 changed files
with
176 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
name: Verify Pull Request | ||
|
||
env: | ||
MAVEN_ARGS: -V -ntp -e | ||
|
||
concurrency: | ||
group: ${{ github.ref }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
@@ -25,9 +22,9 @@ jobs: | |
cache: 'maven' | ||
- name: Check code format | ||
run: | | ||
./mvnw ${MAVEN_ARGS} spotless:check --file pom.xml | ||
./mvnw spotless:check --file pom.xml | ||
build_with_tests: | ||
build_and_run_tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -38,4 +35,16 @@ jobs: | |
java-version: 21 | ||
cache: 'maven' | ||
- name: Run integration tests | ||
run: ./mvnw ${MAVEN_ARGS} clean install | ||
run: ./mvnw clean install | ||
- name: Setup minikube for E2E tests | ||
uses: manusa/[email protected] | ||
with: | ||
minikube version: v1.32.0 | ||
kubernetes version: v1.29.1 | ||
github token: ${{ secrets.GITHUB_TOKEN }} | ||
driver: docker | ||
- name: Run E2E tests | ||
run: | | ||
eval $(minikube -p minikube docker-env) | ||
./mvnw clean install -DskipTests -Dquarkus.container-image.build=true -Dquarkus.kubernetes.namespace=default | ||
./mvnw test -Pe2e-tests |
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
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
21 changes: 0 additions & 21 deletions
21
src/test/java/io/csviri/operator/resourceglue/WebPageE2E.java
This file was deleted.
Oops, something went wrong.
9 changes: 5 additions & 4 deletions
9
src/test/java/io/csviri/operator/resourceglue/sample/webpage/WebPage.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 |
---|---|---|
@@ -1,15 +1,16 @@ | ||
package io.csviri.operator.resourceglue.sample.webpage; | ||
|
||
import io.fabric8.kubernetes.api.model.Namespaced; | ||
import io.fabric8.kubernetes.client.CustomResource; | ||
import io.fabric8.kubernetes.model.annotation.Group; | ||
import io.fabric8.kubernetes.model.annotation.Plural; | ||
import io.fabric8.kubernetes.model.annotation.Singular; | ||
import io.fabric8.kubernetes.model.annotation.Version; | ||
|
||
@Version(value = "v1", storage = true, served = true) | ||
@Version(value = "v1") | ||
@Group("resourceglueoperator.sample") | ||
@Singular("webpage") | ||
@Plural("webpages") | ||
@javax.annotation.processing.Generated("io.fabric8.java.generator.CRGeneratorRunner") | ||
public class WebPage extends io.fabric8.kubernetes.client.CustomResource<WebPageSpec, WebPageStatus> | ||
implements io.fabric8.kubernetes.api.model.Namespaced { | ||
public class WebPage extends CustomResource<WebPageSpec, WebPageStatus> | ||
implements Namespaced { | ||
} |
79 changes: 79 additions & 0 deletions
79
src/test/java/io/csviri/operator/resourceglue/sample/webpage/WebPageE2E.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,79 @@ | ||
package io.csviri.operator.resourceglue; | ||
|
||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import io.csviri.operator.resourceglue.customresource.glue.Glue; | ||
import io.csviri.operator.resourceglue.customresource.operator.GlueOperator; | ||
import io.csviri.operator.resourceglue.sample.webpage.WebPage; | ||
import io.fabric8.kubernetes.api.model.ConfigMap; | ||
import io.fabric8.kubernetes.api.model.Service; | ||
import io.fabric8.kubernetes.api.model.apps.Deployment; | ||
import io.fabric8.kubernetes.api.model.networking.v1.Ingress; | ||
import io.fabric8.kubernetes.client.KubernetesClient; | ||
import io.fabric8.kubernetes.client.KubernetesClientBuilder; | ||
import io.fabric8.kubernetes.client.dsl.NonDeletingOperation; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.awaitility.Awaitility.await; | ||
|
||
public class WebPageE2E { | ||
|
||
private KubernetesClient client = new KubernetesClientBuilder().build(); | ||
|
||
@BeforeEach | ||
void applyCRDs() { | ||
TestUtils.applyCrd(client, Glue.class, GlueOperator.class); | ||
TestUtils.applyTestCrd(client, WebPage.class); | ||
TestUtils.applyAndWait(client, "target/kubernetes/kubernetes.yml"); | ||
} | ||
|
||
@Test | ||
void testDeployment() { | ||
client.resource(TestUtils.load("/sample/webpage/webpage.operator.yaml")) | ||
.createOr(NonDeletingOperation::update); | ||
var webPage = TestUtils.load("/sample/webpage/webpage.sample.yaml", WebPage.class); | ||
var createdWebPage = client.resource(webPage).createOr(NonDeletingOperation::update); | ||
|
||
await().untilAsserted(() -> { | ||
var deployment = | ||
client.resources(Deployment.class).withName(webPage.getMetadata().getName()).get(); | ||
var configMap = | ||
client.resources(ConfigMap.class).withName(webPage.getMetadata().getName()).get(); | ||
var service = client.resources(Service.class).withName(webPage.getMetadata().getName()).get(); | ||
var ingress = client.resources(Ingress.class).withName(webPage.getMetadata().getName()).get(); | ||
|
||
assertThat(deployment).isNotNull(); | ||
assertThat(configMap).isNotNull(); | ||
assertThat(service).isNotNull(); | ||
assertThat(ingress).isNull(); | ||
}); | ||
|
||
createdWebPage.getMetadata().setResourceVersion(null); | ||
createdWebPage.getSpec().setExposed(true); | ||
createdWebPage = client.resource(createdWebPage).update(); | ||
|
||
await().untilAsserted(() -> { | ||
var ingress = client.resources(Ingress.class).withName(webPage.getMetadata().getName()).get(); | ||
assertThat(ingress).isNotNull(); | ||
}); | ||
|
||
client.resource(createdWebPage).delete(); | ||
|
||
await().untilAsserted(() -> { | ||
var deployment = | ||
client.resources(Deployment.class).withName(webPage.getMetadata().getName()).get(); | ||
var configMap = | ||
client.resources(ConfigMap.class).withName(webPage.getMetadata().getName()).get(); | ||
var service = client.resources(Service.class).withName(webPage.getMetadata().getName()).get(); | ||
var ingress = client.resources(Ingress.class).withName(webPage.getMetadata().getName()).get(); | ||
|
||
assertThat(deployment).isNull(); | ||
assertThat(configMap).isNull(); | ||
assertThat(service).isNull(); | ||
assertThat(ingress).isNull(); | ||
}); | ||
} | ||
|
||
} |
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