Skip to content

Commit

Permalink
MGDSTRM-10781 using the project bundle for the test
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Feb 28, 2023
1 parent dfd4d0a commit b6dd483
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 1,331 deletions.
53 changes: 34 additions & 19 deletions bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,31 +65,46 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<!--
Set dependency paths as properties to make operator and sync bundle metadata artifacts
available to bundle generator.
-->
<execution>
<id>define-dependency-properties</id>
<goals>
<goal>properties</goal>
</goals>
<configuration>
<skip>false</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<kas.bundle.operator-archive>${kas.bundle.operator-archive}</kas.bundle.operator-archive>
<kas.bundle.sync-archive>${kas.bundle.sync-archive}</kas.bundle.sync-archive>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>generate-bundle</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<!--
Set dependency paths as properties to make operator and sync bundle metadata artifacts
available to bundle generator.
-->
<execution>
<id>define-dependency-properties</id>
<goals>
<goal>properties</goal>
</goals>
<configuration>
<skip>false</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package org.bf2.kas.fleetshard.bundle;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.fabric8.kubernetes.client.utils.Serialization;
import io.fabric8.zjsonpatch.JsonDiff;
import org.apache.commons.compress.archivers.ArchiveException;
import org.apache.commons.compress.archivers.ArchiveStreamFactory;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
Expand Down Expand Up @@ -40,8 +43,6 @@ void testAssembler() throws Exception {
Path bundleTar = testBundle.resolve("bundle.tar");

System.setProperty("kas.bundle.output-directory", testBundle.toAbsolutePath().toString());
System.setProperty("kas.bundle.operator-archive", targetPath.resolve("test-classes/operator-archive").toString());
System.setProperty("kas.bundle.sync-archive", targetPath.resolve("test-classes/sync-archive").toString());
System.setProperty("kas.bundle.version", "1.2.3");
System.setProperty("kas.bundle.image", "bf2/kas-fleetshard-operator-bundle:1.2.3");
System.setProperty("kas.bundle.tar-image", bundleTar.toString());
Expand Down Expand Up @@ -78,7 +79,10 @@ void testAssembler() throws Exception {
try {
String expected = Files.readString(file);
String actual = new String(layerEntries.get(expectedBundle.relativize(file).toString()), StandardCharsets.UTF_8);
assertEquals(expected, actual);

JsonNode actualJson = Serialization.yamlMapper().readTree(actual);
JsonNode patch = JsonDiff.asJson(Serialization.yamlMapper().readTree(expected), actualJson);
assertEquals("[]", patch.toString(), actual);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ metadata:
spec:
customresourcedefinitions:
owned:
- kind: ManagedKafka
name: managedkafkas.managedkafka.bf2.org
version: v1alpha1
- kind: ManagedKafkaAgent
name: managedkafkaagents.managedkafka.bf2.org
version: v1alpha1
- kind: ManagedKafka
name: managedkafkas.managedkafka.bf2.org
version: v1alpha1
description: Operator That Manages Kafka Instances
displayName: KaaS Fleetshard Operator
install:
Expand Down Expand Up @@ -275,7 +275,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: quay.io/bf2fc6cc711aee1a0c2a82e312df7f2e6b37baa12bd9b1f2fd752e260d93a6f8144ac730947f25caa2bfe6ad0f410da360940ee6d28d6c1688d3822c4055650e/kas-fleetshard-operator:latest
image: kas-fleetshard-operator
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
Expand Down Expand Up @@ -343,7 +343,7 @@ spec:
value: prod
- name: QUARKUS_KUBERNETES_CONFIG_ENABLED
value: "true"
image: quay.io/bf2fc6cc711aee1a0c2a82e312df7f2e6b37baa12bd9b1f2fd752e260d93a6f8144ac730947f25caa2bfe6ad0f410da360940ee6d28d6c1688d3822c4055650e/kas-fleetshard-sync:latest
image: kas-fleetshard-sync
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
Expand Down Expand Up @@ -424,4 +424,4 @@ spec:
provider:
name: bf2 community
url: https://github.com/bf2fc6cc711aee1a0c2a/kas-fleetshard
version: 1.2.3
version: 1.2.3
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
type: object
net:
properties:
_private:
private:
type: boolean
type: object
required:
Expand Down
Loading

0 comments on commit b6dd483

Please sign in to comment.