Skip to content

Commit

Permalink
Merge pull request #44468 from gastaldi/flyway_enabled_k8s
Browse files Browse the repository at this point in the history
Use `QUARKUS_FLYWAY_ACTIVE` instead of `QUARKUS_FLYWAY_ENABLED` env in Kubernetes resources
  • Loading branch information
gsmet authored Nov 14, 2024
2 parents e9a720f + ef97403 commit 7eeb9dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ public ServiceStartBuildItem startActions(FlywayRecorder recorder,
public InitTaskBuildItem configureInitTask(ApplicationInfoBuildItem app) {
return InitTaskBuildItem.create()
.withName(app.getName() + "-flyway-init")
.withTaskEnvVars(Map.of("QUARKUS_INIT_AND_EXIT", "true", "QUARKUS_FLYWAY_ENABLED", "true"))
.withAppEnvVars(Map.of("QUARKUS_FLYWAY_ENABLED", "false"))
.withTaskEnvVars(Map.of("QUARKUS_INIT_AND_EXIT", "true", "QUARKUS_FLYWAY_ACTIVE", "true"))
.withAppEnvVars(Map.of("QUARKUS_FLYWAY_ACTIVE", "false"))
.withSharedEnvironment(true)
.withSharedFilesystem(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ public void assertGeneratedResources(Path kubernetesDir, String name, String tas
&& name.equals(d.getMetadata().getName()))
.map(d -> (Deployment) d).findAny();

assertTrue(deployment.isPresent());
assertThat(deployment).satisfies(j -> j.isPresent());
assertThat(deployment.get()).satisfies(d -> {
assertThat(deployment).isPresent().get().satisfies(d -> {
assertThat(d.getMetadata()).satisfies(m -> {
assertThat(m.getName()).isEqualTo(name);
});
Expand All @@ -56,9 +54,7 @@ public void assertGeneratedResources(Path kubernetesDir, String name, String tas
.filter(j -> "Job".equals(j.getKind()) && jobName.equals(j.getMetadata().getName()))
.map(j -> (Job) j)
.findAny();
assertTrue(job.isPresent());

assertThat(job.get()).satisfies(j -> {
assertThat(job).isPresent().get().satisfies(j -> {
assertThat(j.getSpec()).satisfies(jobSpec -> {
assertThat(jobSpec.getCompletionMode()).isEqualTo("NonIndexed");
assertThat(jobSpec.getTemplate()).satisfies(t -> {
Expand All @@ -69,7 +65,7 @@ public void assertGeneratedResources(Path kubernetesDir, String name, String tas
assertThat(podSpec.getRestartPolicy()).isEqualTo("OnFailure");
assertThat(podSpec.getContainers()).singleElement().satisfies(container -> {
assertThat(container.getName()).isEqualTo(jobName);
assertThat(container.getEnv()).filteredOn(env -> "QUARKUS_FLYWAY_ENABLED".equals(env.getName()))
assertThat(container.getEnv()).filteredOn(env -> "QUARKUS_FLYWAY_ACTIVE".equals(env.getName()))
.singleElement().satisfies(env -> {
assertThat(env.getValue()).isEqualTo("true");
});
Expand Down

0 comments on commit 7eeb9dd

Please sign in to comment.