up other services in a local testing environment • We test against other services in a shared testing environment • Changes to your system breaks tests for other systems https://labs.spotify.com/2018/01/11/testing-of-microservices/ @bsideup
Registry auth on Windows • Fix local Docker Compose on Windows Sep, 2018 @bsideup new DockerComposeContainer(new File("docker-compose.yml")) .withExposedService("redis_1", REDIS_PORT) .withExposedService("db_1", 3306) .withLocalCompose(true);
Registry auth on Windows • Fix local Docker Compose on Windows • Host ports exposing Sep, 2018 @bsideup @BeforeClass public static void setUp() { localPort = server.getAddress().getPort(); Testcontainers.exposeHostPorts(localPort); } @Rule public BrowserWebDriverContainer browser = new BrowserWebDriverContainer() .withCapabilities(new ChromeOptions()); @Test public void testContainerRunningAgainstExposedHostPort() { RemoteWebDriver webDriver = browser.getWebDriver(); webDriver.get( String.format("http://host.testcontainers.internal:%d/", localPort)); final String pageSource = webDriver.getPageSource(); assertTrue(pageSource.contains("Hello from the host!")); }
Registry auth on Windows • Fix local Docker Compose on Windows • Host ports exposing • Random ports in Couchbase • ClickHouse and Postgis modules Sep, 2018 @bsideup
MyTestcontainersTests { // will be shared between test methods @Container static final MySQLContainer MYSQL_CONTAINER = new MySQLContainer(); // will be started before and stopped after each test method @Container PostgreSQLContainer postgresqlContainer = new PostgreSQLContainer() .withDatabaseName("foo") .withUsername("foo") .withPassword(“secret"); @Test void test() { assertTrue(MYSQL_CONTAINER.isRunning()); assertTrue(postgresqlContainer.isRunning()); } }
examples • Env var to turn off Ryuk (for public CIs) • shm + TmpFS settings • Auto dependency updates with Dependabot • Neo4j and Elasticsearch modules Nov, 2018 @bsideup
for the users ✓ Works for most of the containers ✓ Eventually cleanups stale containers (unlike Docker Compose) ✓ The alpha version is available NOW (v1.12.3+) @bsideup
• …including CIs like Jenkins, Travis, CircleCI, GH Actions, Azure Pipelines, … • Provides a great balance between flexibility, usability, speed and features @bsideup