Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Tests should (optionally) fail if container env not available #41

Open
jasondlee opened this issue Nov 15, 2024 · 1 comment
Open

Tests should (optionally) fail if container env not available #41

jasondlee opened this issue Nov 15, 2024 · 1 comment
Assignees

Comments

@jasondlee
Copy link
Collaborator

There are times when a test should be skipped if Docker is not available, while at other times the test should fail. For example, one might want the containerized test to run on Mac or Linux, but not on Windows. This behavior should be easily configured. For example, in the WildFly codebase (from which these annotations were taken), a system property is examined to determine whether to skip or fail. This project needs this sort of flexibility.

For example

if (!isDockerAvailable()) {
    if ("true".equals(System.getProperty("arquillian.testcontainers.require.docker"))) {
        throw new RuntimeException("Docker is required but it is not available or is not properly configured");
    } else {
        throw createException(dockerRequired.value());
    }
}
@jasondlee jasondlee self-assigned this Nov 15, 2024
@jasondlee jasondlee changed the title Test should (optionally) fail if container env not available Tests should (optionally) fail if container env not available Nov 15, 2024
@jamezp
Copy link
Collaborator

jamezp commented Nov 15, 2024

Another option might be to have a system property like org.arquillian.testcontainers.required.exception=java.lang.AssertionError and allow the type to be overridden.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants