File tree Expand file tree Collapse file tree
modules/k6/src/test/java/org/testcontainers/k6 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,11 +14,17 @@ Testcontainers module for [k6](https://registry.hub.docker.com/r/grafana/k6).
1414You can start a K6 container instance from any Java application by using:
1515
1616<!-- codeinclude-->
17- [ Setup the container] ( ../../modules/k6/src/test/java/org/testcontainers/k6/K6ContainerTests.java ) inside_block: standard_k6_test
17+ [ Setup the container] ( ../../modules/k6/src/test/java/org/testcontainers/k6/K6ContainerTests.java ) inside_block: standard_k6
1818<!-- /codeinclude-->
1919
2020The test above uses a simple k6 script, ` test.js ` , with command line options and an injected script variable.
2121
22+ Once the container is started, you can wait for the test results to be collected:
23+
24+ <!-- codeinclude-->
25+ [ Wait for test results] ( ../../modules/k6/src/test/java/org/testcontainers/k6/K6ContainerTests.java ) inside_block: wait
26+ <!-- /codeinclude-->
27+
2228Create a simple k6 test script to be executed as part of your tests:
2329
2430<!-- codeinclude-->
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ void k6StandardTest() throws Exception {
2323 ) {
2424 container .start ();
2525
26+ // wait {
2627 WaitingConsumer consumer = new WaitingConsumer ();
2728 container .followOutput (consumer );
2829
@@ -34,6 +35,7 @@ void k6StandardTest() throws Exception {
3435 3 ,
3536 TimeUnit .SECONDS
3637 );
38+ // }
3739
3840 assertThat (container .getLogs ()).contains ("k6 tests are cool!" );
3941 }
You can’t perform that action at this time.
0 commit comments