Skip to content

Commit

Permalink
test(operator): fix tests dealing with registry version
Browse files Browse the repository at this point in the history
  • Loading branch information
jsenko committed Nov 26, 2024
1 parent 38e162a commit 4f6f6b5
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 29 deletions.
2 changes: 0 additions & 2 deletions operator/controller/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ registry.version=${project.version}
%test.registry.ui.image=quay.io/apicurio/apicurio-registry-ui:latest-snapshot
%dev.registry.ui.image=quay.io/apicurio/apicurio-registry-ui:latest-snapshot

# Maven property
%test.test.operator.project-version=${project.version}
# Maven property
%test.test.operator.project-root=${projectRoot}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import io.apicurio.registry.operator.resource.ResourceFactory;
import io.apicurio.registry.operator.unit.PodTemplateSpecArgumentProviders.*;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.api.model.PodTemplateSpec;
import org.eclipse.microprofile.config.ConfigProvider;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
import org.slf4j.Logger;
Expand All @@ -27,6 +29,7 @@ void testAppPositive(TestCase testCase) {
var primary = getPrimary();
primary.getSpec().getApp().setPodTemplateSpec(testCase.getSpec());
var expected = ResourceFactory.INSTANCE.getDefaultAppDeployment(primary).getSpec().getTemplate();
preprocessTestCaseExpected(testCase.getExpected());
// spotless:off
assertThat(expected)
.usingRecursiveComparison()
Expand Down Expand Up @@ -57,6 +60,7 @@ void testUIPositive(TestCase testCase) {
var primary = getPrimary();
primary.getSpec().getUi().setPodTemplateSpec(testCase.getSpec());
var expected = ResourceFactory.INSTANCE.getDefaultUIDeployment(primary).getSpec().getTemplate();
preprocessTestCaseExpected(testCase.getExpected());
// spotless:off
assertThat(expected)
.usingRecursiveComparison()
Expand Down Expand Up @@ -90,4 +94,9 @@ private static ApicurioRegistry3 getPrimary() {
primary.getSpec().setUi(new ApicurioRegistry3SpecUI());
return primary;
}

private static void preprocessTestCaseExpected(PodTemplateSpec expected) {
expected.getMetadata().getLabels().computeIfPresent("app.kubernetes.io/version",
(k, v) -> ConfigProvider.getConfig().getValue("registry.version", String.class));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: app
Expand Down Expand Up @@ -50,7 +50,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: app
Expand Down Expand Up @@ -95,7 +95,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: app
Expand Down Expand Up @@ -137,7 +137,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: app
Expand Down Expand Up @@ -184,7 +184,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: app
Expand Down Expand Up @@ -234,7 +234,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: app
Expand Down Expand Up @@ -279,7 +279,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: app
Expand Down Expand Up @@ -328,7 +328,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: app
Expand Down Expand Up @@ -382,7 +382,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: app
Expand Down Expand Up @@ -432,7 +432,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: app
Expand Down Expand Up @@ -476,7 +476,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: app
Expand Down Expand Up @@ -514,7 +514,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: app
Expand Down Expand Up @@ -554,7 +554,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: ui
Expand Down Expand Up @@ -50,7 +50,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: ui
Expand Down Expand Up @@ -95,7 +95,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: ui
Expand Down Expand Up @@ -137,7 +137,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: ui
Expand Down Expand Up @@ -184,7 +184,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: ui
Expand Down Expand Up @@ -234,7 +234,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: ui
Expand Down Expand Up @@ -279,7 +279,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: ui
Expand Down Expand Up @@ -328,7 +328,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: ui
Expand Down Expand Up @@ -382,7 +382,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: ui
Expand Down Expand Up @@ -432,7 +432,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: ui
Expand Down Expand Up @@ -476,7 +476,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: ui
Expand Down Expand Up @@ -514,7 +514,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: ui
Expand Down Expand Up @@ -554,7 +554,7 @@ cases:
metadata:
labels:
app.kubernetes.io/name: apicurio-registry
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: placeholder
app.kubernetes.io/instance: test
app.kubernetes.io/part-of: apicurio-registry
app.kubernetes.io/component: ui
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public abstract class OLMITBase {

private static final Logger log = LoggerFactory.getLogger(OLMITBase.class);

public static final String PROJECT_VERSION_PROP = "test.operator.project-version";
public static final String PROJECT_VERSION_PROP = "registry.version";
public static final String PROJECT_ROOT_PROP = "test.operator.project-root";
public static final String CATALOG_IMAGE_PROP = "test.operator.catalog-image";

Expand Down

0 comments on commit 4f6f6b5

Please sign in to comment.