Skip to content

Commit

Permalink
Merge pull request quarkusio#35412 from patriot1burke/opt-in-dev-serv…
Browse files Browse the repository at this point in the history
…ices

Launch mock event server even if devservices.enabled=false
  • Loading branch information
patriot1burke authored Aug 18, 2023
2 parents dfc0169 + 3067804 commit bb28c1a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
7 changes: 7 additions & 0 deletions docs/src/main/asciidoc/aws-lambda-http.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ quarkus.lambda.mock-event-server.test-port=8083

A port value of zero will result in a randomly assigned port.

To turn off the mock event server:
[source, subs=attributes+]
----
quarkus.lambda.mock-event-server.enabled=false
----


== Simulate AWS Lambda Deployment with SAM CLI

The AWS SAM CLI allows you to run your lambda's locally on your laptop in a simulated Lambda environment. This requires Docker to be installed.
Expand Down
7 changes: 7 additions & 0 deletions docs/src/main/asciidoc/aws-lambda.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,13 @@ quarkus.lambda.mock-event-server.test-port=8083

A port value of zero will result in a randomly assigned port.

To turn off the mock event server:
[source, subs=attributes+]
----
quarkus.lambda.mock-event-server.enabled=false
----


== Testing with the SAM CLI
If you do not want to use the mock event server, you can test your lambdas with SAM CLI.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import io.quarkus.deployment.builditem.DevServicesResultBuildItem;
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
import io.quarkus.deployment.builditem.ServiceStartBuildItem;
import io.quarkus.deployment.dev.devservices.GlobalDevServicesConfig;
import io.quarkus.runtime.LaunchMode;

public class DevServicesLambdaProcessor {
Expand Down Expand Up @@ -53,7 +52,7 @@ private boolean legacyTestingEnabled() {
}

@Produce(ServiceStartBuildItem.class)
@BuildStep(onlyIfNot = IsNormal.class, onlyIf = GlobalDevServicesConfig.Enabled.class)
@BuildStep(onlyIfNot = IsNormal.class) // This is required for testing so run it even if devservices.enabled=false
public void startEventServer(LaunchModeBuildItem launchMode,
LambdaConfig config,
Optional<EventServerOverrideBuildItem> override,
Expand All @@ -64,6 +63,9 @@ public void startEventServer(LaunchModeBuildItem launchMode,
return;
if (legacyTestingEnabled())
return;
if (!config.mockEventServer.enabled) {
return;
}
if (server != null) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
*/
@ConfigGroup
public class MockEventServerConfig {
/**
* Setting to true will start event server even if quarkus.devservices.enabled=false
*/
@ConfigItem(defaultValue = "true")
public boolean enabled;

/**
* Port to access mock event server in dev mode
*/
Expand Down

0 comments on commit bb28c1a

Please sign in to comment.