Skip to content

Commit

Permalink
Allow access to dev services props
Browse files Browse the repository at this point in the history
This allows integration tests to access dev services config in the same
way you would with a TestResourceManager.

Fixes #25730
  • Loading branch information
stuartwdouglas committed May 25, 2022
1 parent a9d21f4 commit 2b6222c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ private IntegrationTestExtensionState doNativeStart(ExtensionContext context, Cl
hasPerTestResources = testResourceManager.hasPerTestResources();

Map<String, String> additionalProperties = new HashMap<>(testProfileAndProperties.properties);
additionalProperties.putAll(devServicesProps);
Map<String, String> resourceManagerProps = testResourceManager.start();
Map<String, String> resourceManagerProps = new HashMap<>(testResourceManager.start());
resourceManagerProps.putAll(devServicesProps);
Map<String, String> old = new HashMap<>();
//we also make the dev services config accessible from the test itself
for (Map.Entry<String, String> i : resourceManagerProps.entrySet()) {
old.put(i.getKey(), System.getProperty(i.getKey()));
if (i.getValue() == null) {
Expand All @@ -157,6 +158,7 @@ public void close() throws Throwable {
}
}
});
//this includes dev services props
additionalProperties.putAll(resourceManagerProps);

NativeImageLauncher launcher = createLauncher(requiredTestClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,9 @@ private IntegrationTestExtensionState doProcessStart(Properties quarkusArtifactP
hasPerTestResources = testResourceManager.hasPerTestResources();

Map<String, String> additionalProperties = new HashMap<>(testProfileAndProperties.properties);
additionalProperties.putAll(QuarkusIntegrationTestExtension.devServicesProps);
Map<String, String> resourceManagerProps = testResourceManager.start();
Map<String, String> resourceManagerProps = new HashMap<>(testResourceManager.start());
//we also make the dev services config accessible from the test itself
resourceManagerProps.putAll(QuarkusIntegrationTestExtension.devServicesProps);
Map<String, String> old = new HashMap<>();
for (Map.Entry<String, String> i : resourceManagerProps.entrySet()) {
old.put(i.getKey(), System.getProperty(i.getKey()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ private ArtifactLauncher.LaunchResult doProcessStart(ExtensionContext context, S
testProfileAndProperties.testProfile != null ? testProfileAndProperties.testProfile.getClass().getName()
: null);
Map<String, String> additionalProperties = new HashMap<>(testProfileAndProperties.properties);
additionalProperties.putAll(QuarkusMainIntegrationTestExtension.devServicesProps);
Map<String, String> resourceManagerProps = testResourceManager.start();
Map<String, String> resourceManagerProps = new HashMap<>(testResourceManager.start());
//also make the dev services props accessible from the test
resourceManagerProps.putAll(QuarkusMainIntegrationTestExtension.devServicesProps);
for (Map.Entry<String, String> i : resourceManagerProps.entrySet()) {
old.put(i.getKey(), System.getProperty(i.getKey()));
if (i.getValue() == null) {
Expand Down

0 comments on commit 2b6222c

Please sign in to comment.