Esempio n. 1
0
        public DynamoDBContainerFixture()
        {
            disableTestContainers = Convert.ToBoolean(Environment.GetEnvironmentVariable("DISABLE_TESTCONTAINERS"));

            if (disableTestContainers)
            {
                string hostname = Environment.GetEnvironmentVariable("DYNAMODB_HOSTNAME");
                if (hostname == null)
                {
                    HostName = "localhost";
                }
                else
                {
                    HostName = hostname;
                }

                ServiceUrl = $"http://{HostName}:8000";
            }
            else
            {
                DynamoDbContainer = new GenericContainerBuilder <Container>()
                                    .Begin()
                                    .WithImage("amazon/dynamodb-local:latest")
                                    .WithExposedPorts(8000)
                                    .WithPortBindings((8000, 8000))
                                    .Build();

                ServiceUrl = $"http://{DynamoDbContainer.GetDockerHostIpAddress()}:{DynamoDbContainer.ExposedPorts[0]}";
            }
        }
Esempio n. 2
0
        public DynamoDBContainerFixture()
        {
            disableTestContainers = Convert.ToBoolean(Environment.GetEnvironmentVariable("DISABLE_TESTCONTAINERS"));

            if (disableTestContainers)
            {
                ServiceUrl = LocalServiceUrl;
            }
            else
            {
                DynamoDbContainer = new GenericContainerBuilder <Container>()
                                    .Begin()
                                    .WithImage("amazon/dynamodb-local:latest")
                                    .WithExposedPorts(8000)
                                    .Build();

                ServiceUrl = $"http://{DynamoDbContainer.GetDockerHostIpAddress()}:{DynamoDbContainer.ExposedPorts[0]}";
            }
        }