22
22
import java .io .IOException ;
23
23
import java .io .InputStream ;
24
24
import java .io .InputStreamReader ;
25
+ import java .nio .file .Files ;
26
+ import java .nio .file .Path ;
25
27
import java .util .Objects ;
26
28
27
- import org .checkerframework .checker .nullness .qual .Nullable ;
28
29
import org .junit .jupiter .api .Test ;
30
+ import org .slf4j .Logger ;
31
+ import org .slf4j .LoggerFactory ;
29
32
import org .testcontainers .containers .GenericContainer ;
33
+ import org .testcontainers .containers .output .OutputFrame .OutputType ;
30
34
import org .testcontainers .containers .startupcheck .IndefiniteWaitOneShotStartupCheckStrategy ;
31
35
import org .testcontainers .utility .DockerImageName ;
32
36
35
39
*/
36
40
class RunConformanceTests {
37
41
42
+ private final Logger log = LoggerFactory .getLogger (getClass ());
38
43
private final DockerImageName imageName ;
39
44
40
45
RunConformanceTests () throws IOException {
@@ -57,8 +62,16 @@ void runConformanceTests() {
57
62
58
63
container .start ();
59
64
60
- @ Nullable String destFile = System .getProperty ("jacoco.destFile" );
61
- container .copyFileFromContainer ("/root/jacoco.exec" , destFile != null ? destFile : "jacoco.exec" );
65
+ log .info ("Container stdout:\n {}" , container .getLogs (OutputType .STDOUT ));
66
+ log .debug ("Container stderr:\n {}" , container .getLogs (OutputType .STDERR ));
67
+
68
+ String destFile = System .getProperty ("jacoco.destFile" , "target/jacoco.exec" );
69
+ Path dest = Path .of (destFile ).toAbsolutePath ().normalize ();
70
+ log .info ("Copying test coverage file to: {}" , dest );
71
+ container .copyFileFromContainer ("/root/jacoco.exec" , dest .toString ());
72
+ if (!Files .exists (dest )) {
73
+ log .error ("Failed to copy test coverage file" );
74
+ }
62
75
63
76
// one shot startup strategy waits until the container exits with a successful exit code
64
77
assertThat (container .isRunning ()).isFalse ();
0 commit comments