Skip to content

Commit 64fc1fa

Browse files
committed
Cover Knative deployment integration tests
Relates #31787
1 parent c6c19fc commit 64fc1fa

File tree

6 files changed

+214
-0
lines changed

6 files changed

+214
-0
lines changed

.github/workflows/ci-kubernetes.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,61 @@ jobs:
8888
issueRepo=${{ github.repository }} \
8989
thisRepo=${{ github.repository }}
9090
91+
knative:
92+
name: Knative Integration Tests
93+
needs: cache
94+
runs-on: ubuntu-latest
95+
if: "github.repository == 'quarkusio/quarkus' || github.event_name == 'workflow_dispatch'"
96+
strategy:
97+
fail-fast: false
98+
matrix:
99+
kubernetes: [v1.20.1]
100+
knative: [v1.2.0]
101+
steps:
102+
- name: Checkout
103+
uses: actions/checkout@v3
104+
- uses: actions/setup-java@v3
105+
with:
106+
distribution: 'temurin'
107+
java-version: '17'
108+
- name: Download Maven repository
109+
uses: actions/download-artifact@v3
110+
with:
111+
name: maven-repo
112+
path: .
113+
- name: Extract Maven repository
114+
shell: bash
115+
run: tar -xzf maven-repo.tgz -C ~
116+
- name: Kubernetes KinD Cluster
117+
uses: container-tools/kind-action@v2
118+
with:
119+
version: v0.11.1
120+
registry: true
121+
kubectl_version: ${{ matrix.kubernetes }}
122+
knative_serving: ${{ matrix.knative }}
123+
- name: Run Knative Invoker Tests
124+
run: |
125+
kubectl create namespace knative-tests
126+
kubectl config set-context --current --namespace=knative-tests
127+
export QUARKUS_CONTAINER_IMAGE_GROUP=quarkustesting
128+
export QUARKUS_CONTAINER_IMAGE_TAG=${{ github.sha }}
129+
export QUARKUS_CONTAINER_IMAGE_REGISTRY=$KIND_REGISTRY
130+
export QUARKUS_CONTAINER_IMAGE_INSECURE=true
131+
./mvnw ${MAVEN_ARGS} clean install -pl :quarkus-integration-test-kubernetes-invoker -De2e-tests -Dknative-e2e-tests
132+
- name: Report status
133+
if: "always() && github.repository == 'quarkusio/quarkus'"
134+
shell: bash
135+
run: |
136+
curl -Ls https://sh.jbang.dev | bash -s - app setup
137+
~/.jbang/bin/jbang .github/NativeBuildReport.java \
138+
issueNumber=31837 \
139+
runId=${{ github.run_id }} \
140+
status=${{ job.status }} \
141+
token=${{ secrets.GITHUB_API_TOKEN }} \
142+
issueRepo=${{ github.repository }} \
143+
thisRepo=${{ github.repository }}
144+
145+
91146
openshift:
92147
name: OpenShift Integration Tests
93148
needs: cache
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
invoker.goals=clean package -Dquarkus.kubernetes.deploy=true
2+
# expect a failure since there is no Kubernetes cluster to deploy to
3+
invoker.buildResult = ${build-result}
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<?xml version="1.0"?>
2+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>org.acme</groupId>
6+
<artifactId>knative-jib-build-and-deploy</artifactId>
7+
<version>0.1-SNAPSHOT</version>
8+
<properties>
9+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
10+
<surefire-plugin.version>3.0.0-M9</surefire-plugin.version>
11+
<maven.compiler.source>11</maven.compiler.source>
12+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13+
<maven.compiler.target>11</maven.compiler.target>
14+
</properties>
15+
<dependencyManagement>
16+
<dependencies>
17+
<dependency>
18+
<groupId>io.quarkus</groupId>
19+
<artifactId>quarkus-bom</artifactId>
20+
<version>@project.version@</version>
21+
<type>pom</type>
22+
<scope>import</scope>
23+
</dependency>
24+
</dependencies>
25+
</dependencyManagement>
26+
<dependencies>
27+
<dependency>
28+
<groupId>io.quarkus</groupId>
29+
<artifactId>quarkus-resteasy</artifactId>
30+
</dependency>
31+
<dependency>
32+
<groupId>io.quarkus</groupId>
33+
<artifactId>quarkus-kubernetes</artifactId>
34+
</dependency>
35+
<dependency>
36+
<groupId>io.quarkus</groupId>
37+
<artifactId>quarkus-container-image-jib</artifactId>
38+
</dependency>
39+
<dependency>
40+
<groupId>io.quarkus</groupId>
41+
<artifactId>quarkus-junit5</artifactId>
42+
<scope>test</scope>
43+
</dependency>
44+
<dependency>
45+
<groupId>io.rest-assured</groupId>
46+
<artifactId>rest-assured</artifactId>
47+
<scope>test</scope>
48+
</dependency>
49+
</dependencies>
50+
<build>
51+
<plugins>
52+
<plugin>
53+
<groupId>io.quarkus</groupId>
54+
<artifactId>quarkus-maven-plugin</artifactId>
55+
<version>@project.version@</version>
56+
<executions>
57+
<execution>
58+
<goals>
59+
<goal>build</goal>
60+
</goals>
61+
</execution>
62+
</executions>
63+
</plugin>
64+
<plugin>
65+
<artifactId>maven-surefire-plugin</artifactId>
66+
<version>${surefire-plugin.version}</version>
67+
<configuration>
68+
<systemPropertyVariables>
69+
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
70+
<maven.home>${maven.home}</maven.home>
71+
</systemPropertyVariables>
72+
</configuration>
73+
</plugin>
74+
</plugins>
75+
</build>
76+
<profiles>
77+
<profile>
78+
<id>native</id>
79+
<activation>
80+
<property>
81+
<name>native</name>
82+
</property>
83+
</activation>
84+
<properties>
85+
<quarkus.package.type>native</quarkus.package.type>
86+
</properties>
87+
<build>
88+
<plugins>
89+
<plugin>
90+
<groupId>org.apache.maven.plugins</groupId>
91+
<artifactId>maven-surefire-plugin</artifactId>
92+
<configuration>
93+
<skipTests>${native.surefire.skip}</skipTests>
94+
</configuration>
95+
</plugin>
96+
<plugin>
97+
<artifactId>maven-failsafe-plugin</artifactId>
98+
<version>${surefire-plugin.version}</version>
99+
<executions>
100+
<execution>
101+
<goals>
102+
<goal>integration-test</goal>
103+
<goal>verify</goal>
104+
</goals>
105+
<configuration>
106+
<systemPropertyVariables>
107+
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
108+
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
109+
<maven.home>${maven.home}</maven.home>
110+
</systemPropertyVariables>
111+
</configuration>
112+
</execution>
113+
</executions>
114+
</plugin>
115+
</plugins>
116+
</build>
117+
</profile>
118+
</profiles>
119+
</project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.acme;
2+
3+
import jakarta.ws.rs.GET;
4+
import jakarta.ws.rs.Path;
5+
import jakarta.ws.rs.Produces;
6+
import jakarta.ws.rs.core.MediaType;
7+
8+
@Path("/hello")
9+
public class Hello {
10+
11+
@GET
12+
@Produces(MediaType.TEXT_PLAIN)
13+
public String hello() {
14+
return "hello";
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
quarkus.container-image.registry=docker.io
2+
quarkus.kubernetes.deployment-target=knative
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import io.dekorate.utils.Serialization
2+
import io.fabric8.knative.serving.v1.Service;
3+
import io.fabric8.kubernetes.api.model.KubernetesList
4+
5+
//Check that file exits
6+
String base = basedir
7+
File knativeYml = new File(base, "target/kubernetes/knative.yml")
8+
assert knativeYml.exists()
9+
knativeYml.withInputStream { stream ->
10+
//Check that its parse-able
11+
KubernetesList list = Serialization.unmarshalAsList(stream)
12+
assert list != null
13+
14+
Service service = list.items.find{r -> r.kind == "Service"}
15+
16+
//Check that ti contains a Service named after the project
17+
assert service != null
18+
assert service.metadata.name == "knative-jib-build-and-deploy"
19+
}

0 commit comments

Comments
 (0)