generated from micronaut-projects/micronaut-project-template
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
137 additions
and
16 deletions.
There are no files selected for viewing
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
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,6 @@ | ||
=== Docker Client creation timeout | ||
|
||
The test-resources server communicates with Docker via a docker client. | ||
By default, creation of this client is expected to take less than 10 seconds. | ||
However, under certain circumstances (limited resources, docker in docker, etc.), this may take longer. | ||
To configure the timeout, you can pass a system property `docker.check.timeout.seconds` or an environment variable `TEST_RESOURCES_DOCKER_CHECK_TIMEOUT_SECONDS` with the number of seconds you require. |
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
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,3 @@ | ||
OpenSearch support will automatically start an https://opensearch.org/[OpenSearch] container and provide the value of the `micronaut.opensearch.rest-client.http-hosts` or `micronaut.opensearch.httpclient5.http-hosts` properties. | ||
|
||
The default image (`opensearchproject/opensearch:latest`) can be overwritten by setting the `test-resources.containers.opensearch.image-name` property. |
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
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
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
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
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
54 changes: 54 additions & 0 deletions
54
...aut/test/extensions/testresources/TestResourcesPropertyProvidersWithRequirementsTest.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,54 @@ | ||
/* | ||
* Copyright 2003-2021 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.micronaut.test.extensions.testresources; | ||
|
||
import io.micronaut.context.annotation.Value; | ||
import io.micronaut.test.extensions.junit5.annotation.MicronautTest; | ||
import io.micronaut.test.extensions.testresources.annotation.TestResourcesProperties; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Map; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
@MicronautTest | ||
@TestResourcesProperties( | ||
value = "property-with-requirements", | ||
providers = TestResourcesPropertyProvidersWithRequirementsTest.MyProvider.class | ||
) | ||
public class TestResourcesPropertyProvidersWithRequirementsTest { | ||
|
||
@Value("${some-other-property}") | ||
String derivedFromTestResources; | ||
|
||
@Test | ||
@DisplayName("properties can be computed from test resources when they have requirements") | ||
public void canDerivePropertiesFromTestResources() { | ||
assertEquals("supplied by test resources with requirements: 42 and transformed", derivedFromTestResources); | ||
} | ||
|
||
public static class MyProvider implements TestResourcesPropertyProvider { | ||
@Override | ||
public Map<String, String> provide(Map<String, Object> testProperties) { | ||
String str = (String) testProperties.get("property-with-requirements"); | ||
return Map.of( | ||
"some-other-property", str + " and transformed" | ||
); | ||
} | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -10,3 +10,4 @@ test-resources: | |
log: | ||
regex: ".*Server is ready.*" | ||
toto: 40 | ||
required-property: 42 |
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