-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathTccTestWatcher.java
More file actions
25 lines (20 loc) · 1013 Bytes
/
TccTestWatcher.java
File metadata and controls
25 lines (20 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package cloud.testcontainers.example;
import org.junit.jupiter.api.extension.*;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.dockerclient.TestcontainersHostPropertyClientProviderStrategy;
public class TccTestWatcher implements TestWatcher {
@Override
public void testFailed(ExtensionContext context, Throwable cause) {
TestWatcher.super.testFailed(context, cause);
boolean isTCD = DockerClientFactory.instance().isUsing(TestcontainersHostPropertyClientProviderStrategy.class);
System.out.println();
System.out.println(PrettyStrings.ohNo);
System.out.println();
if (isTCD) {
System.out.println("Is your local Docker running? Please start it or configure Testcontainers Desktop to use Testcontainers Cloud as a runtime!");
} else {
System.out.println("It seems you are not running Testcontainers Desktop nor the CI agent. Have you started it?");
}
System.out.println();
}
}