Giter VIP home page Giter VIP logo

microcks-quarkus's Introduction

Microcks Quarkus

Quarkus extension that enables embedding Microcks as a Dev Service managing mocks for dependencies and contract-testing your API endpoints

Want to see this extension in action? Check out our sample application. ๐Ÿš€

GitHub Workflow Status Version License Project Chat

Build Status

Latest released version is 0.2.6.

Current development version is 0.2.5-SNAPSHOT.

Sonarcloud Quality metrics

Code Smells Reliability Rating Bugs Coverage Technical Debt Security Rating Maintainability Rating

How to use it?

Include it into your project dependencies

If you're using Maven:

<dependency>
  <groupId>io.github.microcks.quarkus</groupId>
  <artifactId>quarkus-microcks</artifactId>
  <version>0.2.6</version>
  <scope>provided</scope>
</dependency>

Don't forget to specify the provided scope as the extension is just for easing your life during development mode and tests ๐Ÿ‘ป

Configuring the Dev Services

By default, and if global Dev Services are not disabled, Microcks Dev Service will run on next mvn quarkus:dev, launching a Microcks Testcontainer to handle your mock dependencies. You can obviously fine-tune the configuration using properties in application.properties. Microcks related properties have the quarkus.microcks prefix.

You can explicitly disable Microcks Dev Service if you want save some resources at some point:

quarkus.microcks.devservices.enabled=false

The local URL exposed by the Microcks container Http port is automatically stored into the quarkus.microcks.default.http property. Microcks container also exposes a gRPC URL for gRPC services, it is store into the quarkus.microcks.default.grpc property. For convenient usage of the Quarkus gRPC client or other libraries, we also provide quarkus.microcks.default.http.host, quarkus.microcks.default.http.port, quarkus.microcks.default.grpc.host and quarkus.microcks.default.grpc.port properties.

Exposed URL is visible in the Quarkus startup logs:

Listening for transport dt_socket at address: 5005
2023-08-09 12:27:22,649 INFO  [io.git.mic.qua.dep.DevServicesMicrocksProcessor] (build-31) The 'default' microcks container is ready on http://localhost:65719
__  ____  __  _____   ___  __ ____  ______ 
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/   
2023-08-09 12:27:23,169 INFO  [io.quarkus] (Quarkus Main Thread) order-service 0.1.0-SNAPSHOT on JVM (powered by Quarkus 3.2.3.Final) started in 4.935s. Listening on: http://localhost:8080
2023-08-09 12:27:23,170 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2023-08-09 12:27:23,170 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, microcks, rest-client-reactive, rest-client-reactive-jackson, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, vertx]

You can also access to Microcks UI using the Quarkus DevUI on http://localhost:8080/q/dev-ui:

Microcks card

Microcks UI

Import content in Microcks

To use Microcks mocks or contract-testing features, you first need to import OpenAPI, Postman Collection, GraphQL, gRPC, HAR or SoapUI artifacts. Artifacts can be imported as main/primary ones or as secondary ones. See Multi-artifacts support for details. Import is done automatically at container startup depending on your configuration.

By default, Microcks Dev Service automatically discover and load artifacts found in main resources folders (typically src/main/resources) and test resources folders (typically src/test/resources). In order to find the correct artifacts and make difference between primary and secondary ones, the Dev Service relies on naming conventions:

  • All the files named *-openapi.yml, *-openapi.yaml, *-openapi.json will be imported as primary artifacts,
  • All the files named *-asyncapi.yml, *-asyncapi.yaml, *-asyncapi.json will be imported as primary artifacts,
  • All the files named *.proto, *.graphql, *-soapui-project.xml will also be imported as primary artifacts,
  • All the files named *postman-collection.json, *postman_collection.json will be imported as secondary artifacts
  • All the files named *.har will be imported as secondary artifacts,
  • All the files named *-metadata.yml, *-metadata.yaml will also be imported as secondary artifacts,

If you want/need a fine control on what's loaded in container, you may use the artifact.primaries and artifact.secondaries configuration properties for that. They are comma-separated lists of paths to your OpenAPI, Postman, GraphQL, gRPC, HAR, or SoapUI artifacts.

quarkus.microcks.devservices.artifacts.primaries=target/classes/order-service-openapi.yaml,target/test-classes/third-parties/apipastries-openapi.yaml
quarkus.microcks.devservices.artifacts.secondaries=target/test-classes/third-parties/apipastries-postman-collection.json

Starting with version 0.2.3, you can also use the remote-artifact.primaries and remote-artifact.secondaries configuration properties to specify URLs to load remote artifacts within the Microcks Dev Service:

quarkus.microcks.devservices.remote-artifacts.primaries=https://raw.githubusercontent.com/microcks/microcks/master/samples/films.graphql
quarkus.microcks.devservices.remote-artifacts.secondaries=https://raw.githubusercontent.com/microcks/microcks/master/samples/films-postman.json

Using mock endpoints for your dependencies

At development time or during your unit tests setup, you'd probably need to configure mock endpoints provided by Microcks containers to set up your base API url calls. For that, you have to configure the host exposition port and change URLs in config:

# Specify here the Mock URL provided by microcks devservices, referencing the quarkus.microcks.default.http
quarkus.rest-client."org.acme.order.client.PastryAPIClient".url=${quarkus.microcks.default.http}/rest/API+Pastries/0.0.1

Launching new contract-tests

If you want to ensure that your application under test is conform to an OpenAPI contract (or many contracts), you can launch a Microcks contract/conformance test using the local server port you're actually running. Microcks container is automatically configured for being able to reach your local application on the configured or default quarkus.http.test-port:

@ConfigProperty(name= "quarkus.http.test-port")
int quarkusHttpPort;

@ConfigProperty(name= "quarkus.microcks.default.http")
String microcksContainerUrl;

@Test
public void testOpenAPIContract() throws Exception {
  // Ask for an Open API conformance to be launched.
  TestRequest testRequest = new TestRequest.Builder()
      .serviceId("Order Service API:0.1.0")
      .runnerType(TestRunnerType.OPEN_API_SCHEMA.name())
      .testEndpoint("http://host.testcontainers.internal:" + quarkusHttpPort + "/api")
      .build();

  TestResult testResult = MicrocksContainer.testEndpoint(microcksContainerUrl, testRequest);
  assertTrue(testResult.isSuccess());

The TestResult gives you access to all details regarding success of failure on different test cases.

A comprehensive Quarkus demo application illustrating both usages is available here: quarkus-order-service.

Configure your Microcks image

By default, Microcks Dev Service will use the quay.io/microcks/microcks-uber:latest image that is the latest stable one. However, you can specify a compatible image of your choice using the following property:

# Specify here the Microcks-uber image you want to use.
quarkus.microcks.devservices.image-name=quay.io/microcks/microcks-uber:nightly

Advanced features with Async and Postman

Starting with version 0.2.0 the Microcks Dev Service also integrates Async API/Event Driven Architecture features and also allow you to implement Different levels of API contract testing in your Inner Loop!

Based on the artifacts the Dev Service discovered or forced with configuration properties, the Dev Service may start additional containers (microcks-async-minion and microcks-postman-runtime) that you may use for contract-testing. The group of containers has been called an ensemble:

# Force the enablement/deactivation of Async API support.
quarkus.microcks.devservices.ensemble.async-enabled=true
# Customize the Microcks-uber-async-minion image you want to use.
quarkus.microcks.devservices.ensemble.async-image-name=quay.io/microcks/microcks-uber-async-minion:nightly

# Force the enablement/deactivation of Postman runtime support.
quarkus.microcks.devservices.ensemble.postman-enabled=true
# Customize the Microcks-postman-runtime image you want to use.
quarkus.microcks.devservices.ensemble.postman-image-name=quay.io/microcks/microcks-postman-runtime:nightly

Postman contract-testing

You can execute a POSTMAN test using an ensemble that way:

// Ask for a Postman Collection conformance to be launched.
TestRequest testRequest = new TestRequest.Builder()
      .serviceId("Order Service API:0.1.0")
      .runnerType(TestRunnerType.POSTMAN.name())
      .testEndpoint("http://host.testcontainers.internal:" + quarkusHttpPort + "/api")
      .build();

TestResult testResult = MicrocksContainer.testEndpoint(microcksContainerUrl, testRequest);

Asynchronous API support

Asynchronous API in the Microcks Dev Service only supports Apache Kafka at time of writing. Additional bindings may be added in the future ; please tell us what you need!

Using mock endpoints for your dependencies

Kafka topics for publishing/receiving mock messages are directly created by Microcks on the bound Kafka broker found in the running Dev Services list. These topics are named from the API name + API version + operation.

For example: when discovering an AsyncAPI named Order Events API with version 0.1.0 and operation orders-reviewed Microcks will create and manage a OrderEventsAPI-0.1.0-orders-reviewed topic. You can reuse this value into your Kafka/Reactive Messaging client configuration:

# Specify here the Mock Topic provided by microcks devservices, following the naming convention.
mp.messaging.incoming.orders-reviewed.connector=smallrye-kafka
mp.messaging.incoming.orders-reviewed.topic=OrderEventsAPI-0.1.0-orders-reviewed
Launching new contract-tests

Using contract-testing techniques on Asynchronous endpoints may require a different style of interacting with the Microcks container. For example, you may need to:

  1. Start the test making Microcks listen to the target async endpoint,
  2. Activate your System Under Tests so that it produces an event,
  3. Finalize the Microcks tests and actually ensure you received one or many well-formed events.

For that the MicrocksContainer now provides a testEndpointAsync(String microcksContainerUrl, TestRequest request) method that actually returns a CompletableFuture. Once invoked, you may trigger your application events and then get() the future result to assert like this:

// Start the test, making Microcks listen the endpoint provided in testRequest
CompletableFuture<TestResult> testRequestFuture = MicrocksContainer.testEndpointAsync(microcksContainerUrl, kafkaTest);

// Invoke the application to create an order.
Order createdOrder = service.placeOrder(info);

// You may check additional stuff on createdOrder...

// Get the Microcks test result.
TestResult testResult = testRequestFuture.get();
assertTrue(testResult.isSuccess());
Retrieving DevServices broker information

When running your AsyncAPI tests using Quarkus Dev Services for providing brokers, knowing the broker URL that is addressable by Microcks is not an easy thing.

To ease this, you can inject the Kafka broker URL and port using the @InjectKafkaInternalEndpoint annotation. This annotation as well as the MicrocksTestCompanion Quarkus test resource are provided by the Microcks Quarkus extension within the quarkus-microcks-test module:

[..]
import io.github.microcks.quarkus.test.InjectKafkaInternalEndpoint;
import io.github.microcks.quarkus.test.MicrocksTestCompanion;

@QuarkusTest
@QuarkusTestResource(MicrocksTestCompanion.class)
public class OrderServiceTests extends BaseTest {

   @Inject
   OrderService service;

   @InjectKafkaInternalEndpoint
   String kafkaInternalEndpoint;

   @Test
   void testEventIsPublishedWhenOrderIsCreated() {
      // Prepare a Microcks test.
      TestRequest kafkaTest = new TestRequest.Builder()
            .serviceId("Order Events API:0.1.0")
            .filteredOperations(List.of("SUBSCRIBE orders-created"))
            .runnerType(TestRunnerType.ASYNC_API_SCHEMA.name())
            .testEndpoint("kafka://%s/orders-created".formatted(kafkaInternalEndpoint))
            .timeout(5000L)
            .build();
      [..]
   }
}

microcks-quarkus's People

Contributors

edeandrea avatar holly-cummins avatar lbroudoux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

microcks-quarkus's Issues

DevServices doesn't work on Quarkus version > 3.6.0

Describe the bug

When upgrading the demo application to Quarkus 3.6.1, the OrderServiceTests stops working and fails. The test is passing for all the Quarkus versions from 3.2.0 to 3.6.0 included.

Expected behavior

The OrderServiceTests should be a success.

Actual behavior

Test is just failing without any ouput...

How to Reproduce?

Move Quarkus version in pom.xml to 3.6.1 and launch mvn test

Microcks version or git rev

0.2.1 of quarkus-microcks

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

No response

Additional information

No response

Allow graceful shutdown of Dev Service container

Describe the bug

As of today, Microcks testcontainer is not gracefully shutdown when the test ends. It is deleted after a certain period of time.

Expected behavior

We want the container to be killed and free resources as soon as possible.

Actual behavior

See description above

How to Reproduce?

Launch a bunch of tests and see the number of orphan containers bumping in your running container list (docker ps command result)

Microcks version or git rev

0.1.0

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

No response

Additional information

No response

Agg gRPC endpoint URL as a registred property of Dev service

Reason/Context

As of today, only Http endpoint URL is registred as dev service property. Because we removed fixed port support (see #4), gRPC endpoint must also be exposed as a property to be retrieved later on.

Description

After having started a new Dev Service / Test container, we should retrieve the gRPC port and store the endpoint value within a dev service property

Implementation ideas

No response

Keycloak timeout with latest Quarkus version

Describe the bug

Since the latest Quarkus version I get a Keycloak timeout when running tests.

I tested the following versions:

  • Quarkus 3.12.3 + Microcks 0.2.6 = works
  • Quarkus 3.13.0 + Microcks 0.2.6 = error
  • Quarkus 3.13.0 + Microcks 0.1.3 = works

Expected behavior

No error.

Actual behavior

[ERROR] Test.test ยป Runtime java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.oidc.deployment.devservices.keycloak.KeycloakDevServicesProcessor#startKeycloakContainer threw an exception: java.lang.RuntimeException: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image quay.io/keycloak/keycloak:25.0.0 at io.quarkus.oidc.deployment.devservices.keycloak.KeycloakDevServicesProcessor.startKeycloakContainer(KeycloakDevServicesProcessor.java:250) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849) at io.quarkus.builder.BuildContext.run(BuildContext.java:256) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521) at java.base/java.lang.Thread.run(Thread.java:1583) at org.jboss.threads.JBossThread.run(JBossThread.java:483) Caused by: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image quay.io/keycloak/keycloak:25.0.0 at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:359) at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:330) at io.quarkus.oidc.deployment.devservices.keycloak.KeycloakDevServicesProcessor.lambda$startContainer$4(KeycloakDevServicesProcessor.java:377) at java.base/java.util.Optional.orElseGet(Optional.java:364) at io.quarkus.oidc.deployment.devservices.keycloak.KeycloakDevServicesProcessor.startContainer(KeycloakDevServicesProcessor.java:402) at io.quarkus.oidc.deployment.devservices.keycloak.KeycloakDevServicesProcessor.startKeycloakContainer(KeycloakDevServicesProcessor.java:198) ... 10 more Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88) at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:344) ... 15 more Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:563) at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:354) at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81) ... 16 more Caused by: java.lang.IllegalStateException: Wait strategy failed. Container exited with code 2 at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:533) ... 18 more Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for log output matching '.*Keycloak.*started.*' at org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy.waitUntilReady(LogMessageWaitStrategy.java:47) at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:52) at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:909) at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:500) ... 18 more

How to Reproduce?

Use Quarkus 3.13.0 + Microcks 0.2.6

Microcks version or git rev

0.2.6

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

mvn package

Additional information

No response

quarkus.microcks.devservices.ensemble.* config not taken into account

Describe the bug

With Quarkus 3.2.10.Final-redhat-00003 and latest quarkus-microcks 0.2.3, it seems like the new configs listed in https://github.com/microcks/microcks-quarkus?tab=readme-ov-file#advanced-features-with-async-and-postman are not taken into account during mvn quarkus:dev mode.

Note that %dev.quarkus.microcks.devservices.image-name property is working well.

Expected behavior

No warnings and ability to customize the async image name to go through a corporate registry.

Actual behavior

I get the following warnings:

2024-04-16 11:03:01,304 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.devservices.ensemble.async-image-name" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-04-16 11:03:01,305 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.devservices.ensemble.async-enabled" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo

async is always enabled (even if there's no AsyncAPI primary artifact) and it uses the default async container image.

How to Reproduce?

src/main/application.properties:

%dev.quarkus.microcks.devservices.ensemble.async-enabled=false

mvn quarkus:dev

Microcks version or git rev

0.2.3

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

No response

Additional information

No response

Finalize live reloading of mock changes

Describe the bug

Live reloading was asked in #35 but doesn't work on released versions. Only with snapshots....

Expected behavior

Artifacts definitions should be reloaded in Microcks DevService as soon as they are saved on the disk.

Actual behavior

Nothing happens...

How to Reproduce?

No response

Microcks version or git rev

0.2.5

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

No response

Additional information

No response

Can't start quarkus 3.4.3

Describe the bug

I'm trying to use this extension as described but Quarkus dev mode does not start up.

Expected behavior

No response

Actual behavior

When I add this extension (version 0.1.1) to a Quarkus 3.4.3 project, dev mode fails to start with the following message:

2023-10-23 14:32:32,576 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor#startMicrocksContainers threw an exception: java.lang.RuntimeException: java.lang.IllegalArgumentException
        at io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.startMicrocksContainers(DevServicesMicrocksProcessor.java:153)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:858)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
        at java.base/java.lang.Thread.run(Thread.java:833)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: java.lang.IllegalArgumentException
        at org.testcontainers.shaded.com.trilead.ssh2.Connection.requestRemotePortForwarding(Connection.java:1317)
        at org.testcontainers.containers.PortForwardingContainer.exposeHostPort(PortForwardingContainer.java:72)
        at org.testcontainers.containers.PortForwardingContainer.exposeHostPort(PortForwardingContainer.java:66)
        at org.testcontainers.Testcontainers.exposeHostPorts(Testcontainers.java:14)
        at io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.lambda$startContainer$1(DevServicesMicrocksProcessor.java:228)
        at java.base/java.util.Optional.orElseGet(Optional.java:364)
        at io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.startContainer(DevServicesMicrocksProcessor.java:282)
        at io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.startMicrocksContainers(DevServicesMicrocksProcessor.java:139)
        ... 11 more

        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:336)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:253)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:60)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:113)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:438)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:56)
        at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:138)
        at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
        at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
        at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor#startMicrocksContainers threw an exception: java.lang.RuntimeException: java.lang.IllegalArgumentException
        at io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.startMicrocksContainers(DevServicesMicrocksProcessor.java:153)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:858)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
        at java.base/java.lang.Thread.run(Thread.java:833)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: java.lang.IllegalArgumentException
        at org.testcontainers.shaded.com.trilead.ssh2.Connection.requestRemotePortForwarding(Connection.java:1317)
        at org.testcontainers.containers.PortForwardingContainer.exposeHostPort(PortForwardingContainer.java:72)
        at org.testcontainers.containers.PortForwardingContainer.exposeHostPort(PortForwardingContainer.java:66)
        at org.testcontainers.Testcontainers.exposeHostPorts(Testcontainers.java:14)
        at io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.lambda$startContainer$1(DevServicesMicrocksProcessor.java:228)
        at java.base/java.util.Optional.orElseGet(Optional.java:364)
        at io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.startContainer(DevServicesMicrocksProcessor.java:282)
        at io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.startMicrocksContainers(DevServicesMicrocksProcessor.java:139)
        ... 11 more

        at io.quarkus.builder.Execution.run(Execution.java:123)
        at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
        at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:160)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:332)
        ... 9 more
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException
        at io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.startMicrocksContainers(DevServicesMicrocksProcessor.java:153)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:858)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
        at java.base/java.lang.Thread.run(Thread.java:833)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: java.lang.IllegalArgumentException
        at org.testcontainers.shaded.com.trilead.ssh2.Connection.requestRemotePortForwarding(Connection.java:1317)
        at org.testcontainers.containers.PortForwardingContainer.exposeHostPort(PortForwardingContainer.java:72)
        at org.testcontainers.containers.PortForwardingContainer.exposeHostPort(PortForwardingContainer.java:66)
        at org.testcontainers.Testcontainers.exposeHostPorts(Testcontainers.java:14)
        at io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.lambda$startContainer$1(DevServicesMicrocksProcessor.java:228)
        at java.base/java.util.Optional.orElseGet(Optional.java:364)
        at io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.startContainer(DevServicesMicrocksProcessor.java:282)
        at io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.startMicrocksContainers(DevServicesMicrocksProcessor.java:139)
        ... 11 more

How to Reproduce?

I added the extension to my pom.xml and then started dev mode and saw the error.

I also tried to configure it to use a postman collection, but that didn't change anything.

Microcks version or git rev

0.1.1

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

No response

Additional information

No response

Expose gRPC settings as 2 different properties : host and port

Reason/Context

As of today, Microcks DevService exposes a configuration URL for gRPC that is the whole URI. Example below:

quarkus.microcks.default.grpc=http://127.0.0.1:60577

However, the Quarkus client has separate configuration elements for the host and port and cannot directly reuse this property. See for example, the configuration of a locations gRPC client:

quarkus.grpc.clients.locations.host=127.0.0.1
quarkus.grpc.clients.locations.port=60577

Description

We propose to publish 2 additional properties from the DevServices so that you could use quarkus.microcks.default.grpc.host and quarkus.microcks.default.grpc.port as placeholders within the gRPC client configuration.

Example:

quarkus.grpc.clients.locations.host=${quarkus.microcks.default.grpc.host}
quarkus.grpc.clients.locations.port=${quarkus.microcks.default.grpc.port}

Implementation ideas

No response

Add auto-discovery of artifacts to import

Reason/Context

In the "Quarkus spirit" of Developer Joy, Convention over Configuration, and reducing plumbing & friction, it could be nice to implement auto-discovery of artifacts to import.

So instead of having to declare these specific properties in application.properties:

quarkus.microcks.devservices.artifacts.primaries=target/classes/order-service-openapi.yaml,target/test-classes/third-parties/apipastries-openapi.yaml,target/test-classes/third-parties/hello-v1.proto
quarkus.microcks.devservices.artifacts.secondaries=target/test-classes/third-parties/apipastries-postman-collection.json,target/test-classes/third-parties/HelloService-postman-collection.json,target/test-classes/third-parties/HelloService-metadata.yml

we could rely on conventions so that artifacts located under src/main/resources and src/test/resources may be automatically discovered and imported into the MicrocksContainer during DevService startup.

Description

This auto-discovery mechanism will only be applied if no quarkus.microcks.devservices.artifacts.* is defined.

We propose to rely on naming conventions:

  • All the files named *-openapi.yml, *-openapi.yaml, *-openapi.json will be imported as primary artifacts,
  • All the files named *-asyncapi.yml, *-asyncapi.yaml, *-asyncapi.json will be imported as primary artifacts,
  • All the files named *.proto, *.graphql, *-soapui-project.xml will also be imported as primary artifacts,
  • All the files named *postman-collection.json, *postman_collection.json will be imported as secondary artifacts
  • All the files named *.har will be imported as secondary artifacts,
  • All the files named *-metadata.yml, *-metadata.yaml will also be imported as secondary artifacts,

Implementation ideas

No response

CORS issue?

Describe the bug

This came from quarkusio/quarkus-super-heroes#687 - whats happening is I have a react app configured to talk to the Microcks dev service. Because its a browser request and my request is a POST, I'm getting a CORS issue because the React app is talking to a different port than where it was originally served from.

image

You can see its doing the CORS pre-flight request

image

which is then failing

image

How do I get around this?

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Microcks version or git rev

quay.io/microcks/microcks-uber:nightly

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

Quarkus dev service

Additional information

No response

Ensemble configuration properties are ignored

Describe the bug

When configuring MicrocksContainersEnsemble like images names, the properties put into application.properties are actually ignored.

Expected behavior

The images configured in application.properties must be used when starting the containers.

Actual behavior

As of today, the following properties are ignored:

quarkus.microcks.devservices.image-name=quay.io/microcks/microcks-uber:1.9.0
quarkus.microcks.devservices.ensemble.async-image-name=quay.io/microcks/microcks-uber-async-minion:1.9.0

How to Reproduce?

Change image names in microcks-quarkus-demo repository and see it has no effect. Dev Service always start the latest ones.

Microcks version or git rev

No response

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

No response

Additional information

No response

DevServicesMicrocksProcessor.ensembleHosts is null exception when devservice is disabled

Describe the bug

mvn verify fails with the following stack trace when Microcks dev service has been explicitly disabled:

java.lang.RuntimeException: 
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor#completeMicrocksEnsemble threw an exception: java.lang.NullPointerException: Cannot invoke "io.github.microcks.quarkus.deployment.MicrocksContainersEnsembleHosts.getMicrocksHost()" because "io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.ensembleHosts" is null
	at io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.complementMicrocksEnsemble(DevServicesMicrocksProcessor.java:248)

Expected behavior

We expect the devservice not to start and not to fail.

Actual behavior

The above runtime exception makes the whole build fail.

How to Reproduce?

No response

Microcks version or git rev

0.2.0

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

No response

Additional information

No response

Ease retrieval of Kafka endpoint in QuarkusTest

Reason/Context

As of today, retrieving the Kafka endpoint to be used into Quarkus unit tests is not that easy... It requires to know the internal of Quarkus DevService and put this retrieval logical into a base class.

See, for example the BaseTest utility method we write for that into the microcks-quakus-demo repository:

   protected String getKafkaInternalEndpoint() {
      String kafkaEndpoint = null;
      if (kafkaBootstrapServers.contains(",")) {
         String[] kafkaAddresses = kafkaBootstrapServers.split(",");
         for (String kafkaAddress : kafkaAddresses) {
            if (kafkaAddress.startsWith("PLAINTEXT://")) {
               kafkaEndpoint = kafkaAddress.replace("PLAINTEXT://", "");
            }
         }
      }
      return kafkaEndpoint;
   }

This should not be the target solution... End user shouldn't have to take care about those details.

Description

The goal is to provide a Quarkus idiomatic way of doing that - in the same way KafkaCompanion maybe injected into QuarkusTest. See https://quarkus.io/guides/kafka#testing-using-a-kafka-broker

Implementation ideas

No response

Make a shared DevService expose all the necessary properties

Reason/Context

DevServices can be shared among different Quarkus applications running in dev mode. Microcks already provide basic support for this.

Description

When reusing a Microcks DevService that has been instantiated by another Quarkus application, we only retrieve the main HTTP endpoint. We're not able to get access to other properties like grpc.host or grpc.port.

We need to find a way to retrieve all those properties when locating an already running container and feed the Quarkus available properties with that values.

Moreover, all the properties today use the quarks. microns.default prefix and are not indexed on the service name. We must rename them according to the actual desired service name (default should stick as the default value).

Implementation ideas

No response

Conflict with starting DevServices if used with quarkus-oidc and Java 21

Describe the bug

If microcks and oidc extensions are installed together, the content of two properties is overwritten
quarkus.oidc.auth-server-url=http://keycloak-j5knf:8080/realms/quarkus
keycloak.url=http://keycloak-j5knf:8080
This breaks the applications dev mode.

Expected behavior

microcks and oidc extensions can be used together.

Actual behavior

No response

How to Reproduce?

Reproducer Repository

Microcks version or git rev

0.2.6

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

quarkus ext add microcks

Additional information

No response

Update copyright + licence headers on all source files

Following our integration as a Cloud Native Computing Foundation Sandbox project, the whole copyright of Microcks has been donated to the CNCF.

Therefore, sources must no longer reference Laurent Broudoux as the owner of copyright. We chose to use the Microcks contributors term to define the group of contributors.

We should then update all the source files to include these new directives.

Remove the fixed ports usage

Reason/Context

Fixed ports were introduced as a hack before discovering the properties registration mechanism of a dev-service. They are not recommended by testcontainers as we're evolving in a highly volatile and dynamic environment. Now that we have property registration and the UI integration, we can retrieve the running port easily and no longer need those ports.

Description

Remove the settings for static ports and update the documentation accordingly.

Implementation ideas

Only dynamic ports should be used.

Digest pinning for microcks-uber-async-minion image

Describe the bug

When trying to use a fixed digest for the microcks-uber-async-minion image via:

quarkus.microcks.devservices.ensemble.async-image-name=quay.io/microcks/microcks-uber-async-minion:1.9.0@sha256:7bf022a341435c5f7c1a9e764e660390de0a2c49578a1763923e2202d0f76fff

I get:

Caused by: java.lang.IllegalStateException: Failed to verify that image 'quay.io/microcks/microcks-uber-async-minion:1.9.0@sha256:7bf022a341435c5f7c1a9e764e660390de0a2c49578a1763923e2202d0f76fff' is a compatible substitute for 'quay.io/microcks/microcks-uber-async-minion'. This generally means that you are trying to use an image that Testcontainers has not been designed to use. If this is deliberate, and if you are confident that the image is compatible, you should declare compatibility in code using the `asCompatibleSubstituteFor` method. For example:
   DockerImageName myImage = DockerImageName.parse("quay.io/microcks/microcks-uber-async-minion:1.9.0@sha256:7bf022a341435c5f7c1a9e764e660390de0a2c49578a1763923e2202d0f76fff").asCompatibleSubstituteFor("quay.io/microcks/microcks-uber-async-minion");
and then use `myImage` instead.
        at org.testcontainers.utility.DockerImageName.assertCompatibleWith(DockerImageName.java:279)
        at io.github.microcks.testcontainers.MicrocksAsyncMinionContainer.<init>(MicrocksAsyncMinionContainer.java:81)
        at io.github.microcks.quarkus.deployment.DevServicesMicrocksProcessor.completeMicrocksEnsemble(DevServicesMicrocksProcessor.java:275)

This is pointing to the same multi-arch manifest digest as when using the latest tag:

quarkus.microcks.devservices.ensemble.async-image-name=quay.io/microcks/microcks-uber-async-minion:latest

Note that digest pinning works fine on quarkus.microcks.devservices.image-name !

Btw it might be risky for quarkus-microcks default config values to point to 'latest' ?
In case there's a breaking on microcks APIs, all previous versions of the extension will fail. It might be safer to point to a tag, though it means releasing a new version of the extension when there's a new minor of microcks...
In my case I also need to configure the registry name of the images to go through an internal registry.

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

mvn quarkus:dev

Microcks version or git rev

0.2.4

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

quarkus:dev

Additional information

podman 4.9.1 running on Windows + WSL.

Combining Microcks dev service with Mongo doesn't work in dev mode

Describe the bug

When running an app in dev mode that uses both Microcks & Mongodb, dev mode fails to start. I'm not sure if it has to do with Liquibase or not, but the exception is coming from liquibase saying it can't connect to Mongo.

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

  1. Clone https://github.com/quarkusio/quarkus-super-heroes
  2. cd into rest-fights
  3. Run ./mvnw clean quarkus:dev

You should see stack traces like

16:09:27 INFO  [or.mo.dr.client] (Quarkus Main Thread) MongoClient with metadata {"driver": {"name": "mongo-java-driver|sync", "version": "4.11.1"}, "os": {"type": "Darwin", "name": "Mac OS X", "architecture": "aarch64", "version": "14.3.1"}, "platform": "Java/Eclipse Adoptium/17.0.10+7"} created with settings MongoClientSettings{readPreference=primary, writeConcern=WriteConcern{w=null, wTimeout=null ms, journal=null}, retryWrites=true, retryReads=true, readConcern=ReadConcern{level=null}, credential=null, transportSettings=null, streamFactoryFactory=null, commandListeners=[], codecRegistry=ProvidersCodecRegistry{codecProviders=[ValueCodecProvider{}, BsonValueCodecProvider{}, DBRefCodecProvider{}, DBObjectCodecProvider{}, DocumentCodecProvider{}, CollectionCodecProvider{}, IterableCodecProvider{}, MapCodecProvider{}, GeoJsonCodecProvider{}, GridFSFileCodecProvider{}, Jsr310CodecProvider{}, JsonObjectCodecProvider{}, BsonCodecProvider{}, EnumCodecProvider{}, com.mongodb.client.model.mql.ExpressionCodecProvider@5c9f0f1b, com.mongodb.Jep395RecordCodecProvider@fee1cd8, com.mongodb.KotlinCodecProvider@3fbeef8d]}, loggerSettings=LoggerSettings{maxDocumentLength=1000}, clusterSettings={hosts=[mongo-secq6:27017], srvServiceName=mongodb, mode=SINGLE, requiredClusterType=UNKNOWN, requiredReplicaSetName='null', serverSelector='null', clusterListeners='[]', serverSelectionTimeout='30000 ms', localThreshold='15 ms'}, socketSettings=SocketSettings{connectTimeoutMS=10000, readTimeoutMS=0, receiveBufferSize=0, proxySettings=ProxySettings{host=null, port=null, username=null, password=null}}, heartbeatSocketSettings=SocketSettings{connectTimeoutMS=10000, readTimeoutMS=10000, receiveBufferSize=0, proxySettings=ProxySettings{host=null, port=null, username=null, password=null}}, connectionPoolSettings=ConnectionPoolSettings{maxSize=100, minSize=0, maxWaitTimeMS=120000, maxConnectionLifeTimeMS=0, maxConnectionIdleTimeMS=0, maintenanceInitialDelayMS=0, maintenanceFrequencyMS=60000, connectionPoolListeners=[], maxConnecting=2}, serverSettings=ServerSettings{heartbeatFrequencyMS=10000, minHeartbeatFrequencyMS=500, serverListeners='[]', serverMonitorListeners='[]'}, sslSettings=SslSettings{enabled=false, invalidHostNameAllowed=false, context=null}, applicationName='null', compressorList=[], uuidRepresentation=UNSPECIFIED, serverApi=null, autoEncryptionSettings=null, dnsClient=null, inetAddressResolver=null, contextProvider=null}

16:09:27 INFO  [or.mo.dr.cluster] (cluster-ClusterId{value='65d9098794916f7ab4eea6bb', description='null'}-mongo-secq6:27017) Exception in monitor thread while connecting to server mongo-secq6:27017: com.mongodb.MongoSocketException: mongo-secq6: nodename nor servname provided, or not known
        at com.mongodb.ServerAddress.getSocketAddresses(ServerAddress.java:221)
        at com.mongodb.internal.connection.ServerAddressWithResolver.getSocketAddresses(ServerAddressWithResolver.java:68)
        at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:100)
        at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:78)
        at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:211)
        at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:196)
        at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:156)
        at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.net.UnknownHostException: mongo-secq6: nodename nor servname provided, or not known
        at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
        at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:934)
        at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1543)
        at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:852)
        at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1533)
        at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1385)
        at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1306)
        at com.mongodb.ServerAddress.getSocketAddresses(ServerAddress.java:213)
        ... 7 more


16:09:27 INFO  [or.mo.dr.cluster] (Quarkus Main Thread) No server chosen by ReadPreferenceServerSelector{readPreference=primary} from cluster description ClusterDescription{type=UNKNOWN, connectionMode=SINGLE, serverDescriptions=[ServerDescription{address=mongo-secq6:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: mongo-secq6: nodename nor servname provided, or not known}, caused by {java.net.UnknownHostException: mongo-secq6: nodename nor servname provided, or not known}}]}. Waiting for 30000 ms before timing out
16:09:28 INFO  [or.mo.dr.cluster] (cluster-ClusterId{value='65d9098794916f7ab4eea6bb', description='null'}-mongo-secq6:27017) Exception in monitor thread while connecting to server mongo-secq6:27017: com.mongodb.MongoSocketException: mongo-secq6
        at com.mongodb.ServerAddress.getSocketAddresses(ServerAddress.java:221)
        at com.mongodb.internal.connection.ServerAddressWithResolver.getSocketAddresses(ServerAddressWithResolver.java:68)
        at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:100)
        at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:78)
        at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:211)
        at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:196)
        at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:156)
        at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.net.UnknownHostException: mongo-secq6
        at java.base/java.net.InetAddress$CachedAddresses.get(InetAddress.java:801)
        at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1533)
        at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1385)
        at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1306)
        at com.mongodb.ServerAddress.getSocketAddresses(ServerAddress.java:213)
        ... 7 more

16:09:57 INFO  [li.command] (Quarkus Main Thread) Logging exception.
ERROR: Exception Details
ERROR: Exception Primary Class:  MongoTimeoutException
ERROR: Exception Primary Reason: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=mongo-secq6:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: mongo-secq6}, caused by {java.net.UnknownHostException: mongo-secq6}}]
ERROR: Exception Primary Source: MongoDB 0
16:09:57 INFO  [li.command] (Quarkus Main Thread) Command execution complete
16:09:57 ERROR [io.qu.ru.Application] (Quarkus Main Thread) Failed to start application (with profile [dev]): java.lang.RuntimeException: Failed to start quarkus
        at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
        at io.quarkus.runtime.Application.start(Application.java:101)
        at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
        at io.quarkus.runner.GeneratedMain.main(Unknown Source)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:113)
        at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.IllegalStateException: Error starting Liquibase
        at io.quarkus.liquibase.mongodb.runtime.LiquibaseMongodbRecorder.doStartActions(LiquibaseMongodbRecorder.java:73)
        at io.quarkus.deployment.steps.LiquibaseMongodbProcessor$startLiquibase1767457900.deploy_0(Unknown Source)
        at io.quarkus.deployment.steps.LiquibaseMongodbProcessor$startLiquibase1767457900.deploy(Unknown Source)
        ... 13 more
Caused by: liquibase.exception.CommandExecutionException: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: Could not query for long
        at liquibase.command.CommandScope.execute(CommandScope.java:253)
        at liquibase.Liquibase.lambda$validate$25(Liquibase.java:1352)
        at liquibase.Scope.lambda$child$0(Scope.java:186)
        at liquibase.Scope.child(Scope.java:195)
        at liquibase.Scope.child(Scope.java:185)
        at liquibase.Scope.child(Scope.java:164)
        at liquibase.Liquibase.runInScope(Liquibase.java:1419)
        at liquibase.Liquibase.validate(Liquibase.java:1347)
        at io.quarkus.liquibase.mongodb.runtime.LiquibaseMongodbRecorder.doStartActions(LiquibaseMongodbRecorder.java:63)
        ... 15 more
Caused by: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: Could not query for long
        at liquibase.nosql.changelog.AbstractNoSqlHistoryService.hasDatabaseChangeLogTable(AbstractNoSqlHistoryService.java:145)
        at liquibase.nosql.changelog.AbstractNoSqlHistoryService.init(AbstractNoSqlHistoryService.java:120)
        at liquibase.command.core.helpers.DatabaseChangelogCommandStep.checkLiquibaseTables(DatabaseChangelogCommandStep.java:141)
        at liquibase.command.core.helpers.DatabaseChangelogCommandStep.run(DatabaseChangelogCommandStep.java:91)
        at liquibase.command.CommandScope.execute(CommandScope.java:217)
        ... 23 more
Caused by: liquibase.exception.DatabaseException: Could not query for long
        at liquibase.nosql.executor.NoSqlExecutor.queryForLong(NoSqlExecutor.java:117)
        at liquibase.nosql.executor.NoSqlExecutor.queryForLong(NoSqlExecutor.java:108)
        at liquibase.ext.mongodb.changelog.MongoHistoryService.existsRepository(MongoHistoryService.java:97)
        at liquibase.nosql.changelog.AbstractNoSqlHistoryService.hasDatabaseChangeLogTable(AbstractNoSqlHistoryService.java:143)
        ... 27 more
Caused by: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=mongo-secq6:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: mongo-secq6}, caused by {java.net.UnknownHostException: mongo-secq6}}]
        at com.mongodb.internal.connection.BaseCluster.createTimeoutException(BaseCluster.java:380)
        at com.mongodb.internal.connection.BaseCluster.selectServer(BaseCluster.java:125)
        at com.mongodb.internal.connection.SingleServerCluster.selectServer(SingleServerCluster.java:46)
        at com.mongodb.internal.binding.ClusterBinding.getReadConnectionSource(ClusterBinding.java:116)
        at com.mongodb.client.internal.ClientSessionBinding.getConnectionSource(ClientSessionBinding.java:128)
        at com.mongodb.client.internal.ClientSessionBinding.getReadConnectionSource(ClientSessionBinding.java:92)
        at com.mongodb.internal.operation.SyncOperationHelper.withSuppliedResource(SyncOperationHelper.java:144)
        at com.mongodb.internal.operation.SyncOperationHelper.withSourceAndConnection(SyncOperationHelper.java:125)
        at com.mongodb.internal.operation.SyncOperationHelper.lambda$executeRetryableRead$4(SyncOperationHelper.java:189)
        at com.mongodb.internal.operation.SyncOperationHelper.lambda$decorateReadWithRetries$12(SyncOperationHelper.java:292)
        at com.mongodb.internal.async.function.RetryingSyncSupplier.get(RetryingSyncSupplier.java:67)
        at com.mongodb.internal.operation.SyncOperationHelper.executeRetryableRead(SyncOperationHelper.java:194)
        at com.mongodb.internal.operation.SyncOperationHelper.executeRetryableRead(SyncOperationHelper.java:176)
        at com.mongodb.internal.operation.CommandReadOperation.execute(CommandReadOperation.java:48)
        at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:153)
        at com.mongodb.client.internal.MongoDatabaseImpl.executeCommand(MongoDatabaseImpl.java:196)
        at com.mongodb.client.internal.MongoDatabaseImpl.runCommand(MongoDatabaseImpl.java:165)
        at com.mongodb.client.internal.MongoDatabaseImpl.runCommand(MongoDatabaseImpl.java:160)
        at com.mongodb.client.internal.MongoDatabaseImpl.runCommand(MongoDatabaseImpl.java:150)
        at liquibase.ext.mongodb.statement.AbstractRunCommandStatement.run(AbstractRunCommandStatement.java:59)
        at liquibase.ext.mongodb.statement.AbstractRunCommandStatement.run(AbstractRunCommandStatement.java:55)
        at liquibase.ext.mongodb.statement.ListCollectionNamesStatement.queryForList(ListCollectionNamesStatement.java:79)
        at liquibase.ext.mongodb.statement.CountCollectionByNameStatement.queryForLong(CountCollectionByNameStatement.java:44)
        at liquibase.ext.mongodb.statement.CountCollectionByNameStatement.queryForLong(CountCollectionByNameStatement.java:33)
        at liquibase.nosql.executor.NoSqlExecutor.queryForLong(NoSqlExecutor.java:115)
        ... 30 more


16:09:58 INFO  [io.qu.de.de.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure

Microcks version or git rev

0.2.2

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

No response

Additional information

No response

Allow loading remote artifacts within Microcks container

Reason/Context

As of today, Microcks DevService can only use locally defined artifacts. Those artifacts must be located within the project workspace. However, development teams want to share common artifacts without duplicating them in different projects.

Description

We want ti be able to provide properties like:

quarkus.microcks.devservices.remote-artifacts.primaries=https://raw.githubusercontent.com/microcks/microcks/master/samples/films.graphql
quarkus.microcks.devservices.remote-artifacts.secondaries=https://raw.githubusercontent.com/microcks/microcks/master/samples/films-postman.json

to be able to load remote artifacts.

Implementation ideas

We have to bump the microcks-testcontainers-java dependency to the version 0.2.5 at least.

Live reloading of mock changes while in quarkus dev mode

Reason/Context

While in quarkus:dev mode, changes to openapi-metadata.yaml file are not taken into account live, and you have to:

  • restart quarkus:dev, which takes time as it has to restart the containers
  • or use the Dev UI to delete and re-apply the metadata

Description

It would be great if the extension would watch for changes in the mock files it has discovered, like other Quarkus extensions do.
The mocks should reload lazily:

  • when a new request arrives in Quarkus
  • or when accessing the Microcks DevUI, when verifying the mocks were correctly parsed.

Implementation ideas

If it's fast, the simpler might be to drop and re-apply all the mocks even if the ones that have not changed, as un-merging primary + secondary artifacts could be tricky ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.