Example #1
0
            public async Task Entrypoint()
            {
                // Given
                var testcontainersBuilder = new TestcontainersBuilder <TestcontainersContainer>()
                                            .WithImage("alpine")
                                            .WithEntrypoint("/bin/sh", "-c", "exit 255");

                // When
                // Then
                await using (IDockerContainer testcontainer = testcontainersBuilder.Build())
                {
                    await testcontainer.StartAsync();

                    Assert.Equal(255, await testcontainer.GetExitCode());
                }
            }
Example #2
0
            public async Task WorkingDirectory()
            {
                // Given
                var testcontainersBuilder = new TestcontainersBuilder <TestcontainersContainer>()
                                            .WithImage("alpine")
                                            .WithCommand("/bin/sh", "-c", "test -d /tmp && exit $? || exit $?")
                                            .WithWorkingDirectory("/tmp");

                // When
                // Then
                await using (IDockerContainer testcontainer = testcontainersBuilder.Build())
                {
                    await testcontainer.StartAsync();

                    Assert.Equal(0, await testcontainer.GetExitCode());
                }
            }