Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Dekorate to 3.2.0 #30006

Merged
merged 1 commit into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
<kotlin.coroutine.version>1.6.4</kotlin.coroutine.version>
<kotlin-serialization.version>1.4.1</kotlin-serialization.version>
<kubernetes-client.version>6.3.1</kubernetes-client.version> <!-- Please check with Java Operator SDK team before updating -->
<dekorate.version>3.1.3</dekorate.version> <!-- Please check with Java Operator SDK team before updating -->
<dekorate.version>3.2.0</dekorate.version> <!-- Please check with Java Operator SDK team before updating -->
<maven-invoker.version>3.2.0</maven-invoker.version>
<awaitility.version>4.2.0</awaitility.version>
<jboss-logmanager.version>1.0.11</jboss-logmanager.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
import java.nio.file.Path;
import java.util.List;

import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.fabric8.kubernetes.api.model.GenericKubernetesResource;
import io.dekorate.servicebinding.model.ServiceBinding;
import io.fabric8.kubernetes.api.model.HasMetadata;
import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.quarkus.builder.Version;
Expand All @@ -21,12 +20,14 @@

public class KubernetesWithAutoMongoBindingTest {

private static final String APP_NAME = "kubernetes-with-auto-mongo-binding";

@RegisterExtension
static final QuarkusProdModeTest config = new QuarkusProdModeTest()
.withApplicationRoot((jar) -> jar.addClasses(GreetingResource.class))
.setApplicationName("kubernetes-with-auto-mogno-binding")
.setApplicationName(APP_NAME)
.setApplicationVersion("0.1-SNAPSHOT")
.withConfigurationResource("kubernetes-with-auto-mongo-binding.properties")
.withConfigurationResource(APP_NAME + ".properties")
.setLogFileName("k8s.log")
.setForcedDependencies(List.of(
Dependency.of("io.quarkus", "quarkus-mongodb-client", Version.getVersion()),
Expand All @@ -48,7 +49,7 @@ public void assertGeneratedResources() throws IOException {
assertThat(kubernetesList).filteredOn(i -> "Deployment".equals(i.getKind())).singleElement().satisfies(i -> {
assertThat(i).isInstanceOfSatisfying(Deployment.class, d -> {
assertThat(d.getMetadata()).satisfies(m -> {
assertThat(m.getName()).isEqualTo("kubernetes-with-auto-mogno-binding");
assertThat(m.getName()).isEqualTo(APP_NAME);
});
assertThat(d.getSpec()).satisfies(deploymentSpec -> {
assertThat(deploymentSpec.getTemplate()).satisfies(t -> {
Expand All @@ -59,18 +60,26 @@ public void assertGeneratedResources() throws IOException {
});
});

assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement()
.isInstanceOfSatisfying(GenericKubernetesResource.class, sb -> assertThat(sb)
.hasFieldOrPropertyWithValue("metadata.name", "kubernetes-with-auto-mogno-binding-mongodb")
.returns("apps", s -> s.get("spec", "application", "group"))
.returns("v1", s -> s.get("spec", "application", "version"))
.returns("Deployment", s -> s.get("spec", "application", "kind"))
.extracting(s -> s.get("spec", "services"))
.asList()
.singleElement().asInstanceOf(InstanceOfAssertFactories.MAP)
.containsEntry("group", "psmdb.percona.com")
.containsEntry("version", "v1-9-0")
.containsEntry("kind", "PerconaServerMongoDB")
.containsEntry("name", "mongodb"));
assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement().satisfies(i -> {
assertThat(i).isInstanceOfSatisfying(ServiceBinding.class, s -> {
assertThat(s.getMetadata()).satisfies(m -> {
assertThat(m.getName()).isEqualTo(APP_NAME + "-mongodb");
});
assertThat(s.getSpec()).satisfies(spec -> {
assertThat(spec.getApplication()).satisfies(a -> {
assertThat(a.getGroup()).isEqualTo("apps");
assertThat(a.getVersion()).isEqualTo("v1");
assertThat(a.getKind()).isEqualTo("Deployment");
});

assertThat(spec.getServices()).hasOnlyOneElementSatisfying(service -> {
assertThat(service.getGroup()).isEqualTo("psmdb.percona.com");
assertThat(service.getVersion()).isEqualTo("v1-9-0");
assertThat(service.getKind()).isEqualTo("PerconaServerMongoDB");
assertThat(service.getName()).isEqualTo("mongodb");
});
});
});
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
import java.nio.file.Path;
import java.util.List;

import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.fabric8.kubernetes.api.model.GenericKubernetesResource;
import io.dekorate.servicebinding.model.ServiceBinding;
import io.fabric8.kubernetes.api.model.HasMetadata;
import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.quarkus.builder.Version;
Expand All @@ -21,12 +20,14 @@

public class KubernetesWithAutoMysqlBindingTest {

private static final String APP_NAME = "kubernetes-with-auto-mysql-binding";

@RegisterExtension
static final QuarkusProdModeTest config = new QuarkusProdModeTest()
.withApplicationRoot((jar) -> jar.addClasses(GreetingResource.class))
.setApplicationName("kubernetes-with-auto-mysql-binding")
.setApplicationName(APP_NAME)
.setApplicationVersion("0.1-SNAPSHOT")
.withConfigurationResource("kubernetes-with-auto-mysql-binding.properties")
.withConfigurationResource(APP_NAME + ".properties")
.setLogFileName("k8s.log")
.setForcedDependencies(List.of(
Dependency.of("io.quarkus", "quarkus-kubernetes", Version.getVersion()),
Expand All @@ -49,7 +50,7 @@ public void assertGeneratedResources() throws IOException {
assertThat(kubernetesList).filteredOn(i -> "Deployment".equals(i.getKind())).singleElement().satisfies(i -> {
assertThat(i).isInstanceOfSatisfying(Deployment.class, d -> {
assertThat(d.getMetadata()).satisfies(m -> {
assertThat(m.getName()).isEqualTo("kubernetes-with-auto-mysql-binding");
assertThat(m.getName()).isEqualTo(APP_NAME);
});
assertThat(d.getSpec()).satisfies(deploymentSpec -> {
assertThat(deploymentSpec.getTemplate()).satisfies(t -> {
Expand All @@ -60,18 +61,26 @@ public void assertGeneratedResources() throws IOException {
});
});

assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement()
.isInstanceOfSatisfying(GenericKubernetesResource.class, sb -> assertThat(sb)
.hasFieldOrPropertyWithValue("metadata.name", "kubernetes-with-auto-mysql-binding-mysql")
.returns("apps", s -> s.get("spec", "application", "group"))
.returns("v1", s -> s.get("spec", "application", "version"))
.returns("Deployment", s -> s.get("spec", "application", "kind"))
.extracting(s -> s.get("spec", "services"))
.asList()
.singleElement().asInstanceOf(InstanceOfAssertFactories.MAP)
.containsEntry("group", "pxc.percona.com")
.containsEntry("version", "v1-9-0")
.containsEntry("kind", "PerconaXtraDBCluster")
.containsEntry("name", "mysql"));
assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement().satisfies(i -> {
assertThat(i).isInstanceOfSatisfying(ServiceBinding.class, s -> {
assertThat(s.getMetadata()).satisfies(m -> {
assertThat(m.getName()).isEqualTo(APP_NAME + "-mysql");
});
assertThat(s.getSpec()).satisfies(spec -> {
assertThat(spec.getApplication()).satisfies(a -> {
assertThat(a.getGroup()).isEqualTo("apps");
assertThat(a.getVersion()).isEqualTo("v1");
assertThat(a.getKind()).isEqualTo("Deployment");
});

assertThat(spec.getServices()).hasOnlyOneElementSatisfying(service -> {
assertThat(service.getGroup()).isEqualTo("pxc.percona.com");
assertThat(service.getVersion()).isEqualTo("v1-9-0");
assertThat(service.getKind()).isEqualTo("PerconaXtraDBCluster");
assertThat(service.getName()).isEqualTo("mysql");
});
});
});
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
import java.nio.file.Path;
import java.util.List;

import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.fabric8.kubernetes.api.model.GenericKubernetesResource;
import io.dekorate.servicebinding.model.ServiceBinding;
import io.fabric8.kubernetes.api.model.HasMetadata;
import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.quarkus.builder.Version;
Expand All @@ -21,12 +20,14 @@

public class KubernetesWithAutoPostgresBindingTest {

private static final String APP_NAME = "kubernetes-with-auto-postgres-binding";

@RegisterExtension
static final QuarkusProdModeTest config = new QuarkusProdModeTest()
.withApplicationRoot((jar) -> jar.addClasses(GreetingResource.class))
.setApplicationName("kubernetes-with-auto-postgres-binding")
.setApplicationName(APP_NAME)
.setApplicationVersion("0.1-SNAPSHOT")
.withConfigurationResource("kubernetes-with-auto-postgres-binding.properties")
.withConfigurationResource(APP_NAME + ".properties")
.setLogFileName("k8s.log")
.setForcedDependencies(List.of(
Dependency.of("io.quarkus", "quarkus-kubernetes", Version.getVersion()),
Expand All @@ -49,7 +50,7 @@ public void assertGeneratedResources() throws IOException {
assertThat(kubernetesList).filteredOn(i -> "Deployment".equals(i.getKind())).singleElement().satisfies(i -> {
assertThat(i).isInstanceOfSatisfying(Deployment.class, d -> {
assertThat(d.getMetadata()).satisfies(m -> {
assertThat(m.getName()).isEqualTo("kubernetes-with-auto-postgres-binding");
assertThat(m.getName()).isEqualTo(APP_NAME);
});
assertThat(d.getSpec()).satisfies(deploymentSpec -> {
assertThat(deploymentSpec.getTemplate()).satisfies(t -> {
Expand All @@ -60,18 +61,26 @@ public void assertGeneratedResources() throws IOException {
});
});

assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement()
.isInstanceOfSatisfying(GenericKubernetesResource.class, sb -> assertThat(sb)
.hasFieldOrPropertyWithValue("metadata.name", "kubernetes-with-auto-postgres-binding-postgresql")
.returns("apps", s -> s.get("spec", "application", "group"))
.returns("v1", s -> s.get("spec", "application", "version"))
.returns("Deployment", s -> s.get("spec", "application", "kind"))
.extracting(s -> s.get("spec", "services"))
.asList()
.singleElement().asInstanceOf(InstanceOfAssertFactories.MAP)
.containsEntry("group", "postgres-operator.crunchydata.com")
.containsEntry("version", "v1beta1")
.containsEntry("kind", "PostgresCluster")
.containsEntry("name", "postgresql"));
assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement().satisfies(i -> {
assertThat(i).isInstanceOfSatisfying(ServiceBinding.class, s -> {
assertThat(s.getMetadata()).satisfies(m -> {
assertThat(m.getName()).isEqualTo(APP_NAME + "-postgresql");
});
assertThat(s.getSpec()).satisfies(spec -> {
assertThat(spec.getApplication()).satisfies(a -> {
assertThat(a.getGroup()).isEqualTo("apps");
assertThat(a.getVersion()).isEqualTo("v1");
assertThat(a.getKind()).isEqualTo("Deployment");
});

assertThat(spec.getServices()).hasOnlyOneElementSatisfying(service -> {
assertThat(service.getGroup()).isEqualTo("postgres-operator.crunchydata.com");
assertThat(service.getVersion()).isEqualTo("v1beta1");
assertThat(service.getKind()).isEqualTo("PostgresCluster");
assertThat(service.getName()).isEqualTo("postgresql");
});
});
});
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
import java.nio.file.Path;
import java.util.List;

import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.fabric8.kubernetes.api.model.GenericKubernetesResource;
import io.dekorate.servicebinding.model.ServiceBinding;
import io.fabric8.kubernetes.api.model.HasMetadata;
import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.quarkus.builder.Version;
Expand All @@ -21,12 +20,14 @@

public class KubernetesWithSemiAutoPostgresBindingTest {

private static final String APP_NAME = "kubernetes-with-semi-auto-postgres-binding";

@RegisterExtension
static final QuarkusProdModeTest config = new QuarkusProdModeTest()
.withApplicationRoot((jar) -> jar.addClasses(GreetingResource.class))
.setApplicationName("kubernetes-with-semi-auto-postgres-binding")
.setApplicationName(APP_NAME)
.setApplicationVersion("0.1-SNAPSHOT")
.withConfigurationResource("kubernetes-with-semi-auto-postgres-binding.properties")
.withConfigurationResource(APP_NAME + ".properties")
.setLogFileName("k8s.log")
.setForcedDependencies(List.of(
Dependency.of("io.quarkus", "quarkus-kubernetes", Version.getVersion()),
Expand All @@ -49,7 +50,7 @@ public void assertGeneratedResources() throws IOException {
assertThat(kubernetesList).filteredOn(i -> "Deployment".equals(i.getKind())).singleElement().satisfies(i -> {
assertThat(i).isInstanceOfSatisfying(Deployment.class, d -> {
assertThat(d.getMetadata()).satisfies(m -> {
assertThat(m.getName()).isEqualTo("kubernetes-with-semi-auto-postgres-binding");
assertThat(m.getName()).isEqualTo(APP_NAME);
});
assertThat(d.getSpec()).satisfies(deploymentSpec -> {
assertThat(deploymentSpec.getTemplate()).satisfies(t -> {
Expand All @@ -60,18 +61,26 @@ public void assertGeneratedResources() throws IOException {
});
});

assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement()
.isInstanceOfSatisfying(GenericKubernetesResource.class, sb -> assertThat(sb)
.hasFieldOrPropertyWithValue("metadata.name", "kubernetes-with-semi-auto-postgres-binding-postgresql")
.returns("apps", s -> s.get("spec", "application", "group"))
.returns("v1", s -> s.get("spec", "application", "version"))
.returns("Deployment", s -> s.get("spec", "application", "kind"))
.extracting(s -> s.get("spec", "services"))
.asList()
.singleElement().asInstanceOf(InstanceOfAssertFactories.MAP)
.containsEntry("group", "my.custom-operator.com")
.containsEntry("version", "v1alpha1")
.containsEntry("kind", "Postgres")
.containsEntry("name", "postgresql"));
assertThat(kubernetesList).filteredOn(i -> "ServiceBinding".equals(i.getKind())).singleElement().satisfies(i -> {
assertThat(i).isInstanceOfSatisfying(ServiceBinding.class, s -> {
assertThat(s.getMetadata()).satisfies(m -> {
assertThat(m.getName()).isEqualTo(APP_NAME + "-postgresql");
});
assertThat(s.getSpec()).satisfies(spec -> {
assertThat(spec.getApplication()).satisfies(a -> {
assertThat(a.getGroup()).isEqualTo("apps");
assertThat(a.getVersion()).isEqualTo("v1");
assertThat(a.getKind()).isEqualTo("Deployment");
});

assertThat(spec.getServices()).hasOnlyOneElementSatisfying(service -> {
assertThat(service.getGroup()).isEqualTo("my.custom-operator.com");
assertThat(service.getVersion()).isEqualTo("v1alpha1");
assertThat(service.getKind()).isEqualTo("Postgres");
assertThat(service.getName()).isEqualTo("postgresql");
});
});
});
});
}
}
Loading