-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Keycloak * Kafka/RedPanda * amqp * Postgresql * Mysql * Mariadb * Mssql
- Loading branch information
Showing
21 changed files
with
696 additions
and
5 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...test/java/io/quarkus/ts/messaging/amqpreactive/DevModeAmqpDevServiceUserExperienceIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.quarkus.ts.messaging.amqpreactive; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import com.github.dockerjava.api.model.Image; | ||
|
||
import io.quarkus.test.bootstrap.RestService; | ||
import io.quarkus.test.scenarios.QuarkusScenario; | ||
import io.quarkus.test.services.DevModeQuarkusApplication; | ||
|
||
@Tag("QUARKUS-959") | ||
@QuarkusScenario | ||
public class DevModeAmqpDevServiceUserExperienceIT { | ||
|
||
private static final String AMQP_VERSION = "0.1.3"; | ||
private static final String AMQP_IMAGE = "quay.io/artemiscloud/activemq-artemis-broker"; | ||
|
||
/** | ||
* AMQP must be started using DEV services when running in DEV mode | ||
*/ | ||
@DevModeQuarkusApplication | ||
static RestService app = new RestService() | ||
.withProperty("quarkus.amqp.devservices.image-name", String.format("%s:%s", AMQP_IMAGE, AMQP_VERSION)) | ||
.onPreStart(s -> DockerUtils.removeImage(AMQP_IMAGE, AMQP_VERSION)); | ||
|
||
@Test | ||
public void verifyIfUserIsInformedAboutAmqpDevServicePulling() { | ||
app.logs().assertContains("Pulling docker image: quay.io/artemiscloud/activemq-artemis-broker"); | ||
app.logs().assertContains("Please be patient; this may take some time but only needs to be done once"); | ||
app.logs().assertContains("Starting to pull image"); | ||
app.logs().assertContains("Dev Services for AMQP started"); | ||
} | ||
|
||
@Test | ||
public void verifyAmqpImage() { | ||
Image postgresImg = DockerUtils.getImage(AMQP_IMAGE, AMQP_VERSION); | ||
Assertions.assertFalse(postgresImg.getId().isEmpty(), String.format("%s:%s not found. " + | ||
"Notice that user set his own custom image by 'quarkus.keycloak.devservices.image-name' property", | ||
AMQP_IMAGE, AMQP_VERSION)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
messaging/amqp-reactive/src/test/java/io/quarkus/ts/messaging/amqpreactive/DockerUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package io.quarkus.ts.messaging.amqpreactive; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import org.testcontainers.DockerClientFactory; | ||
|
||
import com.github.dockerjava.api.DockerClient; | ||
import com.github.dockerjava.api.model.Image; | ||
|
||
// TODO this DockerUtils must be removed once this changes will be released | ||
// https://github.com/quarkus-qe/quarkus-test-framework/blob/main/quarkus-test-images/src/main/java/io/quarkus/test/utils/DockerUtils.java | ||
public class DockerUtils { | ||
|
||
private static final DockerClient DOCKER_CLIENT = DockerClientFactory.instance().client();; | ||
|
||
/** | ||
* Returns true if docker images contains expectedVersion. | ||
* | ||
* @param image docker images | ||
* @param expectedVersion expected docker image version | ||
*/ | ||
public static boolean isVersion(Image image, String expectedVersion) { | ||
boolean exist = false; | ||
String[] tags = Optional.ofNullable(image.getRepoTags()).orElse(new String[] {}); | ||
for (String tag : tags) { | ||
if (tag.contains(expectedVersion)) { | ||
exist = true; | ||
break; | ||
} | ||
} | ||
|
||
return exist; | ||
} | ||
|
||
/** | ||
* Returns true if docker image is removed. | ||
* | ||
* @param name docker image name | ||
* @param version docker image version | ||
*/ | ||
public static boolean removeImage(String name, String version) { | ||
boolean removed = false; | ||
Image image = getImage(name, version); | ||
if (isVersion(image, version)) { | ||
String id = image.getId().substring(image.getId().lastIndexOf(":") + 1); | ||
DOCKER_CLIENT.removeImageCmd(id).withForce(true).exec(); | ||
removed = true; | ||
} | ||
return removed; | ||
} | ||
|
||
/** | ||
* Returns an image based on the provided image name and version. If no image is found then a default empty image. | ||
* is returned | ||
* | ||
* @param name docker image name | ||
* @param version docker image version | ||
*/ | ||
public static Image getImage(String name, String version) { | ||
Image result = new Image(); | ||
List<Image> images = DOCKER_CLIENT.listImagesCmd().withImageNameFilter(name).exec(); | ||
for (Image image : images) { | ||
if (isVersion(image, version)) { | ||
result = image; | ||
break; | ||
} | ||
} | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...rc/test/java/io/quarkus/ts/messaging/kafka/DevModeRedPandaDevServiceUserExperienceIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.quarkus.ts.messaging.kafka; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import com.github.dockerjava.api.model.Image; | ||
|
||
import io.quarkus.test.bootstrap.RestService; | ||
import io.quarkus.test.scenarios.QuarkusScenario; | ||
import io.quarkus.test.services.DevModeQuarkusApplication; | ||
|
||
@Tag("QUARKUS-959") | ||
@QuarkusScenario | ||
public class DevModeRedPandaDevServiceUserExperienceIT { | ||
|
||
private static final String RED_PANDA_VERSION = "latest"; | ||
private static final String RED_PANDA_IMAGE = "vectorized/redpanda"; | ||
|
||
@DevModeQuarkusApplication | ||
static RestService app = new RestService() | ||
.withProperty("quarkus.kafka.devservices.enabled", Boolean.TRUE.toString()) | ||
.withProperty("quarkus.kafka.devservices.image-name", String.format("%s:%s", RED_PANDA_IMAGE, RED_PANDA_VERSION)) | ||
.onPreStart(s -> DockerUtils.removeImage(RED_PANDA_IMAGE, RED_PANDA_VERSION)); | ||
|
||
@Test | ||
public void verifyIfUserIsInformedAboutRedPandaDevServicePulling() { | ||
app.logs().assertContains("Pulling docker image: vectorized/redpanda"); | ||
app.logs().assertContains("Please be patient; this may take some time but only needs to be done once"); | ||
app.logs().assertContains("Starting to pull image"); | ||
app.logs().assertContains("Dev Services for Kafka started"); | ||
} | ||
|
||
@Test | ||
public void verifyRedPandaImage() { | ||
Image postgresImg = DockerUtils.getImage(RED_PANDA_IMAGE, RED_PANDA_VERSION); | ||
Assertions.assertFalse(postgresImg.getId().isEmpty(), String.format("%s:%s not found. " + | ||
"Notice that user set his own custom image by 'quarkus.datasource.devservices.image-name' property", | ||
RED_PANDA_IMAGE, RED_PANDA_VERSION)); | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
...a-streams-reactive-messaging/src/test/java/io/quarkus/ts/messaging/kafka/DockerUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package io.quarkus.ts.messaging.kafka; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import org.testcontainers.DockerClientFactory; | ||
|
||
import com.github.dockerjava.api.DockerClient; | ||
import com.github.dockerjava.api.model.Image; | ||
|
||
// TODO this DockerUtils must be removed once this changes will be released | ||
// https://github.com/quarkus-qe/quarkus-test-framework/blob/main/quarkus-test-images/src/main/java/io/quarkus/test/utils/DockerUtils.java | ||
public class DockerUtils { | ||
|
||
private static final DockerClient DOCKER_CLIENT = DockerClientFactory.instance().client();; | ||
|
||
/** | ||
* Returns true if docker images contains expectedVersion. | ||
* | ||
* @param image docker images | ||
* @param expectedVersion expected docker image version | ||
*/ | ||
public static boolean isVersion(Image image, String expectedVersion) { | ||
boolean exist = false; | ||
String[] tags = Optional.ofNullable(image.getRepoTags()).orElse(new String[] {}); | ||
for (String tag : tags) { | ||
if (tag.contains(expectedVersion)) { | ||
exist = true; | ||
break; | ||
} | ||
} | ||
|
||
return exist; | ||
} | ||
|
||
/** | ||
* Returns true if docker image is removed. | ||
* | ||
* @param name docker image name | ||
* @param version docker image version | ||
*/ | ||
public static boolean removeImage(String name, String version) { | ||
boolean removed = false; | ||
Image image = getImage(name, version); | ||
if (isVersion(image, version)) { | ||
String id = image.getId().substring(image.getId().lastIndexOf(":") + 1); | ||
DOCKER_CLIENT.removeImageCmd(id).withForce(true).exec(); | ||
removed = true; | ||
} | ||
return removed; | ||
} | ||
|
||
/** | ||
* Returns an image based on the provided image name and version. If no image is found then a default empty image. | ||
* is returned | ||
* | ||
* @param name docker image name | ||
* @param version docker image version | ||
*/ | ||
public static Image getImage(String name, String version) { | ||
Image result = new Image(); | ||
List<Image> images = DOCKER_CLIENT.listImagesCmd().withImageNameFilter(name).exec(); | ||
for (Image image : images) { | ||
if (isVersion(image, version)) { | ||
result = image; | ||
break; | ||
} | ||
} | ||
return result; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...cloak/src/test/java/io/quarkus/ts/security/DevModeKeycloakDevServiceUserExperienceIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package io.quarkus.ts.security; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import com.github.dockerjava.api.model.Image; | ||
|
||
import io.quarkus.test.bootstrap.RestService; | ||
import io.quarkus.test.scenarios.QuarkusScenario; | ||
import io.quarkus.test.scenarios.annotations.DisabledOnNative; | ||
import io.quarkus.test.services.DevModeQuarkusApplication; | ||
|
||
@Tag("QUARKUS-959") | ||
@QuarkusScenario | ||
public class DevModeKeycloakDevServiceUserExperienceIT { | ||
|
||
private static final String KEYCLOAK_VERSION = "13.0.1"; | ||
private static final String KEYCLOAK_IMAGE = "quay.io/keycloak/keycloak"; | ||
|
||
/** | ||
* Keycloak must be started using DEV services when running in DEV mode | ||
*/ | ||
@DevModeQuarkusApplication | ||
static RestService app = new RestService() | ||
.withProperty("quarkus.keycloak.devservices.image-name", String.format("%s:%s", KEYCLOAK_IMAGE, KEYCLOAK_VERSION)) | ||
.onPreStart(s -> DockerUtils.removeImage(KEYCLOAK_IMAGE, KEYCLOAK_VERSION)); | ||
|
||
@Test | ||
public void verifyIfUserIsInformedAboutKeycloakDevServicePulling() { | ||
app.logs().assertContains("Pulling docker image: quay.io/keycloak/keycloak"); | ||
app.logs().assertContains("Please be patient; this may take some time but only needs to be done once"); | ||
app.logs().assertContains("Starting to pull image"); | ||
// TODO https://github.com/quarkusio/quarkus/issues/19485 | ||
//app.logs().assertContains("Dev Services for Keycloak started"); | ||
} | ||
|
||
@Test | ||
public void verifyKeycloakImage() { | ||
Image postgresImg = DockerUtils.getImage(KEYCLOAK_IMAGE, KEYCLOAK_VERSION); | ||
Assertions.assertFalse(postgresImg.getId().isEmpty(), String.format("%s:%s not found. " + | ||
"Notice that user set his own custom image by 'quarkus.keycloak.devservices.image-name' property", | ||
KEYCLOAK_IMAGE, KEYCLOAK_VERSION)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.