Skip to content

Commit d460616

Browse files
committed
Make the container rule fields private and drop synchronized
The constants are only used within the rule, and JUnit 4 initializes the class rule on a single thread per JVM fork, so the lock guards nothing. Signed-off-by: sanghun <vitash1215@gmail.com>
1 parent 65bb540 commit d460616

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

java-client/src/test/java21/org/opensearch/client/opensearch/integTest/OpenSearchTestContainerRule.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
* after each class; Testcontainers' Ryuk reaper removes it once the JVM exits.
2020
*/
2121
final class OpenSearchTestContainerRule extends ExternalResource {
22-
static final String ENABLED_PROPERTY = "tests.opensearch.testcontainers.enabled";
23-
static final String VERSION_PROPERTY = "tests.opensearch.version";
24-
static final String IMAGE_PROPERTY = "tests.opensearch.image";
25-
static final String CLUSTER_PROPERTY = "tests.rest.cluster";
26-
static final String HTTPS_PROPERTY = "https";
27-
static final String USER_PROPERTY = "user";
28-
static final String PASSWORD_PROPERTY = "password";
22+
private static final String ENABLED_PROPERTY = "tests.opensearch.testcontainers.enabled";
23+
private static final String VERSION_PROPERTY = "tests.opensearch.version";
24+
private static final String IMAGE_PROPERTY = "tests.opensearch.image";
25+
private static final String CLUSTER_PROPERTY = "tests.rest.cluster";
26+
private static final String HTTPS_PROPERTY = "https";
27+
private static final String USER_PROPERTY = "user";
28+
private static final String PASSWORD_PROPERTY = "password";
2929

3030
private static final String DEFAULT_ADMIN_PASSWORD = "admin";
3131

@@ -36,7 +36,7 @@ protected void before() {
3636
startIfNeeded();
3737
}
3838

39-
static synchronized void startIfNeeded() {
39+
private static void startIfNeeded() {
4040
if (hasText(System.getProperty(CLUSTER_PROPERTY)) || !testcontainersEnabled()) {
4141
return;
4242
}

0 commit comments

Comments
 (0)