public void RunTestcontainerWithoutCleanUp()
            {
                // Given
                const string id = nameof(this.RunTestcontainerWithoutCleanUp);

                // When
                TestcontainersRegistryService.Register(id);

                // Then
                Assert.DoesNotContain(id, TestcontainersRegistryService.GetRegisteredContainers());
            }
            public void RemoveTestcontainer()
            {
                // Given
                const string id = nameof(this.RemoveTestcontainer);

                // When
                TestcontainersRegistryService.Register(id, true);
                TestcontainersRegistryService.Unregister(id);

                // Then
                Assert.DoesNotContain(id, TestcontainersRegistryService.GetRegisteredContainers());
            }
Example #3
0
        private static void PurgeOrphanedContainers()
        {
            var args = string.Join(" ", TestcontainersRegistryService.GetRegisteredContainers());

            if (string.IsNullOrEmpty(args))
            {
                return;
            }

            new Process {
                StartInfo = { FileName = "docker", Arguments = $"rm --force {args}" }
            }.Start();
        }