Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

fix: initialize service-call authorizer at startup (#6876)

Vũ Thế Huya950c704c70e
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/ServiceCallAuthorizer.java b/src/main/java/io/github/hectorvent/floci/core/common/ServiceCallAuthorizer.java
index f7cb387768..ee41f15062 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/ServiceCallAuthorizer.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/ServiceCallAuthorizer.java
@@ -5,6 +5,7 @@ import io.github.hectorvent.floci.services.iam.IamPolicyEvaluator;
import io.github.hectorvent.floci.services.iam.IamPolicyEvaluator.Decision;
import io.github.hectorvent.floci.services.iam.ResourcePolicyProvider;
import io.github.hectorvent.floci.services.iam.ResourcePolicyProviders;
+import io.quarkus.runtime.Startup;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Instance;
import jakarta.inject.Inject;
@@ -30,6 +31,7 @@ import java.util.Map;
* The decision is returned rather than thrown, because what a refusal means is the caller's to
* decide: a notification that is not delivered, a delivery that is retried, or an error.
*/
+@Startup
@ApplicationScoped
public class ServiceCallAuthorizer {
diff --git a/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftSnapshotEventsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftSnapshotEventsIntegrationTest.java
index 9a7404af43..47e2c91ace 100644
--- a/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftSnapshotEventsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/redshift/RedshiftSnapshotEventsIntegrationTest.java
@@ -33,8 +33,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.TimeUnit;
import static org.awaitility.Awaitility.await;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -98,7 +96,7 @@ class RedshiftSnapshotEventsIntegrationTest {
new TypeReference<Map<String, Cluster>>() { });
Instant due = clusters.getForAccount(OWNER, clusterId).orElseThrow()
.getAutomatedSnapshotAnchor().plusSeconds(3600);
- CompletableFuture.runAsync(() -> scheduler.tick(due)).get(20, TimeUnit.SECONDS);
+ scheduler.tick(due);
List<Event> history = snapshotEvents(ownerWest.redshift(), clusterId);
assertEquals(List.of("REDSHIFT-EVENT-2009", terminalEvent), history.stream().map(Event::eventId).toList());