public async Task InitializeAsync()
 {
     if (options.Value.Enabled)
     {
         await _localStackContainer.StartAsync();
     }
 }
示例#2
0
        private static async Task Main(string[] args)
        {
            Console.WriteLine("Press any key to start LocalStack container");
            Console.ReadLine();

            ITestcontainersBuilder <TestcontainersContainer> localStackBuilder = new TestcontainersBuilder <TestcontainersContainer>()
                                                                                 .WithName("LocalStack-0.12.10")
                                                                                 .WithImage("localstack/localstack:0.12.10")
                                                                                 .WithCleanUp(true)
                                                                                 .WithEnvironment("DEFAULT_REGION", "eu-central-1")
                                                                                 .WithEnvironment("SERVICES", "iam,lambda,dynamodb,apigateway,s3,sns,cloudformation,cloudwatch,sts")
                                                                                 .WithEnvironment("DOCKER_HOST", "unix:///var/run/docker.sock")
                                                                                 .WithEnvironment("LS_LOG", "info")
                                                                                 .WithPortBinding(4566, 4566);

            TestcontainersContainer container = localStackBuilder.Build();

            Console.WriteLine("Starting LocalStack Container");
            await container.StartAsync();

            Console.WriteLine("LocalStack Container started");

            Console.WriteLine("Press any key to stop LocalStack container");
            Console.ReadLine();

            Console.WriteLine("Stopping LocalStack Container");
            await container.StopAsync();

            Console.WriteLine("LocalStack Container stopped");
        }
示例#3
0
        public async Task <IZeebeClient> SetupIntegrationTest()
        {
            container = CreateZeebeContainer();
            await container.StartAsync();

            client = CreateZeebeClient();
            await AwaitBrokerReadiness();

            return(client);
        }
示例#4
0
 public async Task OneTimeSetup()
 {
     _testcontainersBuilder = new TestcontainersBuilder <TestcontainersContainer>()
                              .WithImage("postgres:12.2")
                              .WithName("gto-infra-test")
                              .WithPortBinding(5432)
                              .WithEnvironment("POSTGRES_USER", PostgresUser)
                              .WithEnvironment("POSTGRES_PASSWORD", PostgresPassword)
                              .WithEnvironment("POSTGRES_DB", PostgresDb)
                              .WithCleanUp(true)
                              .WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(5432));
     _postgres = _testcontainersBuilder.Build();
     await _postgres.StartAsync();
 }
示例#5
0
    public void StartLocalStackContainer()
    {
        var localStackBuilder = new TestcontainersBuilder <TestcontainersContainer>()
                                .WithImage("localstack/localstack")
                                .WithCleanUp(true)
                                .WithEnvironment("DEFAULT_REGION", "ap-southeast-2")
                                .WithEnvironment("SERVICES", "sqs")
                                .WithEnvironment("DOCKER_HOST", "unix:///var/run/docker.sock")
                                .WithEnvironment("DEBUG", "1")
                                .WithPortBinding(4566, 4566);

        _localStackContainer = localStackBuilder.Build();
        _localStackContainer.StartAsync();
    }
示例#6
0
        public PostgreSQLFixture()
        {
            if (_container == null)
            {
                _container = BuildConsulContainer();
                _container.StartAsync();

                // Let's wait for the container startup.
                Task.Delay(20 * 1000).Wait();
            }

            var dbContext = new DevicesContext(new DbContextOptionsBuilder().UseNpgsql(CONNECTION_STRING).Options);

            _dataProvider = new DataProvider(dbContext);
        }
示例#7
0
        public ElasticSearchInContainerFixture()
        {
            var testContainersBuilder = new TestcontainersBuilder <TestcontainersContainer>()
                                        .WithImage("elasticsearch:6.4.0")
                                        .WithName("elasticsearch-33333")
                                        .WithEnvironment("discovery.type", "single-node")
                                        .WithPortBinding(9200, 9200)
                                        .WithPortBinding(9300, 9300)
                                        .WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(9200));

            testContainer = testContainersBuilder.Build();
            testContainer.StartAsync().Wait();

            InsertData();
        }
示例#8
0
        public Infra()
        {
            // Configure Host
            IHostBuilder hostBuilder = Program.CreateHostBuilder(null !);

            hostBuilder.UseEnvironment("test")
            .ConfigureWebHost(builder => { builder.UseTestServer(); });

            TestServerHost  = hostBuilder.Build();
            ServiceProvider = TestServerHost.Services;

            // Create external dependencies and run
            _dbTestContainer = BuildSqlServerTestContainer(ServiceProvider);
            Task dbRunTask = _dbTestContainer.StartAsync();

            Task.WaitAll(dbRunTask);

            // Run Test Server
            TestServerHost.Start();

            HttpClient = TestServerHost.GetTestClient();
        }
 public async Task InitializeAsync()
 {
     await _localStackContainer.StartAsync();
 }
示例#10
0
 internal Task StartAsync() => _container.StartAsync();
示例#11
0
 public async Task StartAsync()
 {
     await _container.StartAsync();
 }