Light, fluffy, and always free - The AWS Local Emulator alternative
fix(ecr): Shutdown ecr registry manager on observable shutdown event (#1063)
Steve34d739edf876
diff --git a/src/main/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycle.java b/src/main/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycle.javaindex b0fb513ba7..93b8ec9ff7 100644--- a/src/main/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycle.java+++ b/src/main/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycle.java@@ -6,6 +6,7 @@ import io.github.hectorvent.floci.core.storage.StorageFactory;import io.github.hectorvent.floci.lifecycle.inithook.InitializationHook;import io.github.hectorvent.floci.lifecycle.inithook.InitializationHooksRunner;import io.github.hectorvent.floci.services.ec2.Ec2MetadataServer;+import io.github.hectorvent.floci.services.ecr.registry.EcrRegistryManager;import io.github.hectorvent.floci.services.elasticache.container.ElastiCacheContainerManager;import io.github.hectorvent.floci.services.elasticache.container.ElastiCacheMemcachedContainerManager;import io.github.hectorvent.floci.services.elasticache.proxy.ElastiCacheProxyManager;@@ -54,6 +55,7 @@ public class EmulatorLifecycle {private final DynamoDbStreamsEventSourcePoller dynamodbStreamsPoller;private final PipesService pipesService;private final Ec2MetadataServer ec2MetadataServer;+ private final EcrRegistryManager ecrRegistryManager;private final InitLifecycleState initLifecycleState;@Inject@@ -70,6 +72,7 @@ public class EmulatorLifecycle {DynamoDbStreamsEventSourcePoller dynamodbStreamsPoller,PipesService pipesService,Ec2MetadataServer ec2MetadataServer,+ EcrRegistryManager ecrRegistryManager,InitLifecycleState initLifecycleState) {this.storageFactory = storageFactory;this.serviceRegistry = serviceRegistry;@@ -85,6 +88,7 @@ public class EmulatorLifecycle {this.dynamodbStreamsPoller = dynamodbStreamsPoller;this.pipesService = pipesService;this.ec2MetadataServer = ec2MetadataServer;+ this.ecrRegistryManager = ecrRegistryManager;this.initLifecycleState = initLifecycleState;}@@ -186,6 +190,7 @@ public class EmulatorLifecycle {elastiCacheContainerManager.stopAll();elastiCacheMemcachedContainerManager.stopAll();rdsContainerManager.stopAll();+ ecrRegistryManager.shutdown();storageFactory.shutdownAll();LOG.info("=== AWS Local Emulator Stopped ===");diff --git a/src/test/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycleTest.java b/src/test/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycleTest.javaindex 06b9b8728b..2ce6b57b3a 100644--- a/src/test/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycleTest.java+++ b/src/test/java/io/github/hectorvent/floci/lifecycle/EmulatorLifecycleTest.java@@ -13,6 +13,7 @@ import io.github.hectorvent.floci.services.lambda.DynamoDbStreamsEventSourcePollimport io.github.hectorvent.floci.services.lambda.KinesisEventSourcePoller;import io.github.hectorvent.floci.services.lambda.SqsEventSourcePoller;import io.github.hectorvent.floci.services.ec2.Ec2MetadataServer;+import io.github.hectorvent.floci.services.ecr.registry.EcrRegistryManager;import io.github.hectorvent.floci.services.pipes.PipesService;import io.github.hectorvent.floci.services.rds.container.RdsContainerManager;import io.github.hectorvent.floci.services.rds.proxy.RdsProxyManager;@@ -56,6 +57,7 @@ class EmulatorLifecycleTest {@Mock private DynamoDbStreamsEventSourcePoller dynamodbStreamsPoller;@Mock private PipesService pipesService;@Mock private Ec2MetadataServer ec2MetadataServer;+ @Mock private EcrRegistryManager ecrRegistryManager;@Mock private InitLifecycleState initLifecycleState;@Mock private EmulatorConfig.TlsConfig tlsConfig;@@ -74,7 +76,7 @@ class EmulatorLifecycleTest {elastiCacheContainerManager, elastiCacheMemcachedContainerManager,elastiCacheProxyManager, rdsContainerManager, rdsProxyManager,initializationHooksRunner, sqsPoller, kinesisPoller, dynamodbStreamsPoller,- pipesService, ec2MetadataServer, initLifecycleState);+ pipesService, ec2MetadataServer, ecrRegistryManager, initLifecycleState);}private void stubStorageConfig() {