Skip to content

Commit

Permalink
Use QUARKUS_FLYWAY_ACTIVE instead of QUARKUS_FLYWAY_ENABLED env i…
Browse files Browse the repository at this point in the history
…n Kubernetes resources

Because the original property is a build-time configuration property
  • Loading branch information
gastaldi committed Nov 13, 2024
1 parent 323ba29 commit ef97403
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 ef97403

Please sign in to comment.