Skip to content

Commit

Permalink
Prepare test suite to work with podman
Browse files Browse the repository at this point in the history
1. Tag all tests, which are incompatible with podman
2. Add workarounds, if applicable
  • Loading branch information
fedinskiy committed Jun 1, 2023
1 parent 66ba2c3 commit 097d717
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ The suite uses `org.junit.jupiter.api.Tag` annotation to group similar tests tog
- `use-quarkus-openshift-extension`: tests use `quarkus-openshift` extension to deploy the app
- `serverless`: use Openshift Serverless to deploy the app
- `quarkus-cli`: tests use Quarkus CLI, which needs to be installed ( see https://quarkus.io/guides/cli-tooling for details)
- `podman-incompatible`: tests, which require Docker as a container engine and are not compatible with Podman.

## Running against Red Hat build of Quarkus

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Objects;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import com.github.dockerjava.api.model.Image;
Expand All @@ -13,6 +14,7 @@
import io.quarkus.test.utils.DockerUtils;

@QuarkusScenario
@Tag("podman-incompatible") //TODO: https://github.com/quarkusio/quarkus/issues/28721
public class DockerBuildIT {

private static final String DOCKER_IMG_NAME = "hello-world-app";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

@Tag("QUARKUS-1089")
@QuarkusScenario
@Tag("podman-incompatible") //todo fails on podman 4.4.1, works on 4.5.0 and above
public class ConfluentKafkaAvroGroupIdIT extends BaseKafkaAvroGroupIdIT {

@KafkaContainer(vendor = KafkaVendor.CONFLUENT, withRegistry = true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.quarkus.ts.messaging.kafka;

import org.junit.jupiter.api.Tag;

import io.quarkus.test.bootstrap.KafkaService;
import io.quarkus.test.bootstrap.RestService;
import io.quarkus.test.scenarios.QuarkusScenario;
Expand All @@ -8,6 +10,7 @@
import io.quarkus.test.services.containers.model.KafkaVendor;

@QuarkusScenario
@Tag("podman-incompatible") //todo fails on podman 4.4.1, works on 4.5.0 and above
public class ConfluentKafkaAvroIT extends BaseKafkaAvroIT {

@KafkaContainer(vendor = KafkaVendor.CONFLUENT, withRegistry = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@QuarkusScenario
@DisabledOnNative(reason = "Compatibility mode check in JVM mode is enough for this DB")
@Tag("fips-incompatible") // Reported in https://github.com/IBM/Db2/issues/43
@Tag("podman-incompatible") //TODO https://github.com/containers/podman/issues/16432
public class DB2DatabaseIT extends AbstractSqlDatabaseIT {

@Container(image = "${db2.image}", port = 50000, expectedLog = "Setup has completed")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

@QuarkusScenario
@Tag("fips-incompatible") // Reported in https://github.com/IBM/Db2/issues/43
@Tag("podman-incompatible") //TODO: https://github.com/containers/podman/issues/16432
public class DB2DatabaseIT extends AbstractSqlDatabaseIT {

@Container(image = "${db2.image}", port = 50000, expectedLog = "Setup has completed")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.quarkus.ts.sqldb.sqlapp;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -37,9 +38,15 @@ public void verifyIfUserIsInformedAboutMariadbDevServicePulling() {

@Test
public void verifyMysqlImage() {
Image postgresImg = DockerUtils.getImage(MARIA_DB_NAME, MARIA_DB_VERSION);
Assertions.assertFalse(postgresImg.getId().isEmpty(), String.format("%s:%s not found. " +
Image image = DockerUtils.getImage(MARIA_DB_NAME, MARIA_DB_VERSION);
Assertions.assertFalse(image.getId().isEmpty(), String.format("%s:%s not found. " +
"Notice that user set his own custom image by 'quarkus.datasource.devservices.image-name' property",
MARIA_DB_NAME, MARIA_DB_VERSION));
}

@AfterAll
//TODO workaround for podman 4.4.1 on rhel. Without it, *next* test (eg MariaDBDatabaseIT) fails with "broken pipe"
public static void clear() {
DockerUtils.removeImage(MARIA_DB_NAME, MARIA_DB_VERSION);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.quarkus.ts.sqldb.sqlapp;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -38,9 +39,15 @@ public void verifyIfUserIsInformedAboutMssqlDevServicePulling() {

@Test
public void verifyMssqlImage() {
Image postgresImg = DockerUtils.getImage(MSSQL_NAME, MSSQL_VERSION);
Assertions.assertFalse(postgresImg.getId().isEmpty(), String.format("%s:%s not found. " +
Image image = DockerUtils.getImage(MSSQL_NAME, MSSQL_VERSION);
Assertions.assertFalse(image.getId().isEmpty(), String.format("%s:%s not found. " +
"Notice that user set his own custom image by 'quarkus.datasource.devservices.image-name' property",
MSSQL_NAME, MSSQL_VERSION));
}

@AfterAll
//TODO workaround for podman 4.4.1 on rhel. Without it, *next* test (eg MariaDBDatabaseIT) fails with "broken pipe"
public static void clear() {
DockerUtils.removeImage(MSSQL_NAME, MSSQL_VERSION);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static io.quarkus.ts.sqldb.sqlapp.DbUtil.getImageName;
import static io.quarkus.ts.sqldb.sqlapp.DbUtil.getImageVersion;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -40,9 +41,15 @@ public void verifyIfUserIsInformedAboutMysqlDevServicePulling() {

@Test
public void verifyMysqlImage() {
Image postgresImg = DockerUtils.getImage(MYSQL_NAME, MYSQL_VERSION);
Assertions.assertFalse(postgresImg.getId().isEmpty(), String.format("%s:%s not found. " +
Image image = DockerUtils.getImage(MYSQL_NAME, MYSQL_VERSION);
Assertions.assertFalse(image.getId().isEmpty(), String.format("%s:%s not found. " +
"Notice that user set his own custom image by 'quarkus.datasource.devservices.image-name' property",
MYSQL_NAME, MYSQL_VERSION));
}

@AfterAll
//TODO workaround for podman 4.4.1 on rhel. Without it, *next* test (eg MariaDBDatabaseIT) fails with "broken pipe"
public static void clear() {
DockerUtils.removeImage(MYSQL_NAME, MYSQL_VERSION);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static io.quarkus.ts.sqldb.sqlapp.DbUtil.getImageName;
import static io.quarkus.ts.sqldb.sqlapp.DbUtil.getImageVersion;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -43,4 +44,10 @@ public void verifyOracleImage() {
"Notice that user set his own custom image by 'quarkus.datasource.devservices.image-name' property",
ORACLE_NAME, ORACLE_VERSION));
}

@AfterAll
//TODO workaround for podman 4.4.1 on rhel. Without it, *next* test (eg MariaDBDatabaseIT) fails with "broken pipe"
public static void clear() {
DockerUtils.removeImage(ORACLE_NAME, ORACLE_VERSION);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static io.quarkus.ts.sqldb.sqlapp.DbUtil.getImageName;
import static io.quarkus.ts.sqldb.sqlapp.DbUtil.getImageVersion;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -48,4 +49,10 @@ public void verifyPostgresqlImage() {
"Notice that user set his own custom image by 'quarkus.datasource.devservices.image-name' property",
POSTGRES_NAME, POSTGRESQL_VERSION));
}

@AfterAll
//TODO workaround for podman 4.4.1 on rhel. Without it, *next* test (eg MariaDBDatabaseIT) fails with "broken pipe"
public static void clear() {
DockerUtils.removeImage(POSTGRES_NAME, POSTGRESQL_VERSION);
}
}

0 comments on commit 097d717

Please sign in to comment.