The Past, the Present and the Future
(for slides, idea and everything else)
@bsideup
The internal SRI* software exception was caused during execution of a data conversion from 64-bit floating point to 16-bit signed integer value. The floating point number which was converted had a value greater than what could be represented by a 16-bit signed integer.
R10 Include trajectory data in specifications and test requirements.
R11 Review the test coverage of existing equipment and extend it where it is deemed necessary.
R12 Give the justification documents the same attention as code. Improve the technique for keeping code and its justifications consistent.
R13 Set up a team that will prepare the procedure for qualifying software, propose stringent rules for confirming such qualification, and ascertain that specification, verification and testing of software are of a consistently high quality in the Ariane 5 programme. Including external RAMS experts is to be considered.
"I use the term integrated test to mean any test whose result (pass or fail) depends on the correctness of the implementation of more than one piece of non-trivial behavior." - J.B. Rainsberger
"A test that will pass or fail based on the correctness of another system." - Spotify
For example:
GenericContainer redis =
new GenericContainer("redis:3.0.2")
.withExposedPorts(6379);
redis.start();
// test my stuff
redis.stop();
@whichrich
@ashleymcnamara
@Testcontainers
class TestContainersClassIT extends Specification {
@Shared
GenericContainer genericContainer =
new GenericContainer("postgres:latest")
.withExposedPorts(5432)
.withEnv([
POSTGRES_USER: "foo"
POSTGRES_PASSWORD: "secret"
])
}
// Set up a redis container
@ClassRule
public static GenericContainer redis =
new GenericContainer("redis:3.0.2")
.withExposedPorts(6379);
@Testcontainers
class SomeTest {
@Container
private MySQLContainer mySQLContainer = new MySQLContainer();
@Test
void someTestMethod() {
String url = mySQLContainer.getJdbcUrl();
// create a connection and run test as normal
}
}
Testcontainers.exposeHostPorts(localServerPort);
final String rootUrl =
String.format("http://host.testcontainers.internal:%d/", localServerPort);
You can see an example test that could
have been written for it (without using Testcontainers):
<!--codeinclude-->
[Pre-Testcontainers test code]
(../examples/junit5/redis/src/test/java/quickstart/RedisBackedCacheIntTestStep0.java)
block:RedisBackedCacheIntTestStep0
<!--/codeinclude-->
GenericContainer container = new GenericContainer()
.dependsOn(postgresContainer, kafkaContainer);
new GenericContainer<>(imageName)
.withImagePullPolicy(PullPolicy.alwaysPull())
AgeBasedPullPolicy oneHour = new AgeBasedPullPolicy(
Duration.of(1L, ChronoUnit.HOURS)
);
new GenericContainer<>(imageName)
.withImagePullPolicy(oneHour)
public DockerComposeContainer environment =
new DockerComposeContainer(new File("src/test/resources/compose-test.yml"))
.withExposedService("redis_1", REDIS_PORT)
.withExposedService("db_1", 3306);
Optional<ContainerState> result = environment.getContainerByServiceName("db_1");
r2dbc:tc:mysql:///databasename?TC_IMAGE_TAG=5.7.22
// deprecrate
new XyzContainer()
new XyzContainer(String)
// in favor for
new XyzContainer(DockerImageName)
// allowing
new XyzContainer( DockerImageName.parse( "the/image:tag" ) )
private GenericContainer myContainer = new GenericContainer("myImage:42.23") {{
withExposedPorts(4711);
if (System.getenv().get("INSIDE_CI") == null) {
org.testcontainers.Testcontainers.exposeHostPorts(8080);
}
}};
val redisContainer = GenericContainer<Nothing>("redis:3-alpine")
.apply {
withExposedPorts(6379)
}
TODO: add Safe Harbor Statement here