コード例 #1
0
 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
ファイル: DbSetUpFixture.cs プロジェクト: gtoru/server
 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();
        }
コード例 #9
0
 public async Task InitializeAsync()
 {
     await _localStackContainer.StartAsync();
 }
コード例 #10
0
 internal Task StartAsync() => _container.StartAsync();
コード例 #11
0
 public async Task StartAsync()
 {
     await _container.StartAsync();
 }