Skip to content

Commit f0d4703

Browse files
author
Jonathan Knight
committed
Bug 37893106 - Build: Intermittent failure in custom access controller tests
(merge 14.1.2.0 -> ce/14.1.2.0 116837) [git-p4: depot-paths = "//dev/coherence-ce/release/coherence-ce-v14.1.2.0/": change = 116839]
1 parent 5730a90 commit f0d4703

File tree

2 files changed

+46
-21
lines changed

2 files changed

+46
-21
lines changed

prj/examples/guides/810-custom-access-controller/src/test/java/com/oracle/coherence/guides/security/CertSecurityTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ public static void setup() throws Exception
126126
DisplayName.of("storage-2"),
127127
RoleName.of("storage"));
128128

129+
// ensure member 1 is running before starting member-2
130+
Eventually.assertDeferred(s_storage1::isCoherenceRunning, is(true));
131+
129132
s_storage2 = LocalPlatform.get().launch(CoherenceClusterMember.class, options2.asArray());
130133

131134
// ensure both members start

prj/test/functional/security/src/main/java/security/CertSecuritySingleStoreTests.java

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
import com.oracle.bedrock.OptionsByType;
1111
import com.oracle.bedrock.runtime.LocalPlatform;
12-
import com.oracle.bedrock.runtime.coherence.CoherenceCluster;
13-
import com.oracle.bedrock.runtime.coherence.CoherenceClusterBuilder;
1412
import com.oracle.bedrock.runtime.coherence.CoherenceClusterMember;
1513
import com.oracle.bedrock.runtime.coherence.callables.IsCoherenceRunning;
1614
import com.oracle.bedrock.runtime.coherence.options.CacheConfig;
@@ -27,7 +25,6 @@
2725
import com.oracle.bedrock.runtime.java.options.IPv4Preferred;
2826
import com.oracle.bedrock.runtime.java.options.SystemProperty;
2927
import com.oracle.bedrock.runtime.options.DisplayName;
30-
import com.oracle.bedrock.runtime.options.StabilityPredicate;
3128
import com.oracle.bedrock.testsupport.MavenProjectFileUtils;
3229
import com.oracle.bedrock.testsupport.deferred.Eventually;
3330
import com.oracle.bedrock.testsupport.junit.TestLogs;
@@ -110,37 +107,60 @@ public static void setup() throws Exception
110107
}
111108
else
112109
{
113-
// Start the cluster with two storage/proxy members
114-
CoherenceClusterBuilder builder = new CoherenceClusterBuilder()
115-
.with(s_commonOptions.asArray())
116-
.include(2, CoherenceClusterMember.class,
117-
ClassName.of(SecureCoherence.class),
110+
// Start the first storage/proxy member
111+
OptionsByType options1 = OptionsByType.of(s_commonOptions)
112+
.addAll(ClassName.of(SecureCoherence.class),
118113
LocalStorage.enabled(),
119-
MemberName.withDiscriminator("member"),
114+
MemberName.of("member-1"),
120115
SystemProperty.of("coherence.security.keystore", s_keyAndCertSet.getP12Keystore().getAbsolutePath()),
121-
SystemProperty.of("coherence.security.login.password", s_keyAndCertSet.storePasswordString()),
116+
SystemProperty.of("coherence.security.keystore.password", s_keyAndCertSet.storePasswordString()),
117+
SystemProperty.of("coherence.security.permissions", s_urlPerm.getFile()),
122118
SystemProperty.of("coherence.security.truststore", s_keyAndCertSet.getP12Keystore().getAbsolutePath()),
123119
SystemProperty.of("coherence.security.truststore.password", s_keyAndCertSet.storePasswordString()),
124120
SystemProperty.of("coherence.security.permissions", s_urlPerm.getFile()),
125-
DisplayName.of("storage"),
126-
RoleName.of("storage"),
127-
StabilityPredicate.none());
121+
DisplayName.of("storage-1"),
122+
RoleName.of("storage"));
128123

129-
s_cluster = builder.build();
124+
s_storage1 = LocalPlatform.get().launch(CoherenceClusterMember.class, options1.asArray());
130125

131-
for (CoherenceClusterMember member : s_cluster)
132-
{
133-
Eventually.assertDeferred(() -> member.invoke(IsCoherenceRunning.instance()), is(true));
134-
}
126+
// Start the second storage/proxy member
127+
OptionsByType options2 = OptionsByType.of(s_commonOptions)
128+
.addAll(ClassName.of(SecureCoherence.class),
129+
LocalStorage.enabled(),
130+
MemberName.of("member-2"),
131+
SystemProperty.of("coherence.security.keystore", s_keyAndCertSet.getP12Keystore().getAbsolutePath()),
132+
SystemProperty.of("coherence.security.keystore.password", s_keyAndCertSet.storePasswordString()),
133+
SystemProperty.of("coherence.security.permissions", s_urlPerm.getFile()),
134+
SystemProperty.of("coherence.security.truststore", s_keyAndCertSet.getP12Keystore().getAbsolutePath()),
135+
SystemProperty.of("coherence.security.truststore.password", s_keyAndCertSet.storePasswordString()),
136+
SystemProperty.of("coherence.security.permissions", s_urlPerm.getFile()),
137+
DisplayName.of("storage-2"),
138+
RoleName.of("storage"));
139+
140+
// ensure member 1 is running before starting member-2
141+
Eventually.assertDeferred(s_storage1::isCoherenceRunning, is(true));
142+
143+
s_storage2 = LocalPlatform.get().launch(CoherenceClusterMember.class, options2.asArray());
144+
145+
// ensure both members start
146+
Eventually.assertDeferred(() -> s_storage1.invoke(IsCoherenceRunning.instance()), is(true));
147+
Eventually.assertDeferred(() -> s_storage2.invoke(IsCoherenceRunning.instance()), is(true));
148+
// they should have formed a cluster
149+
Eventually.assertDeferred(() -> s_storage1.getClusterSize(), is(2));
150+
Eventually.assertDeferred(() -> s_storage2.getClusterSize(), is(2));
135151
}
136152
}
137153

138154
@AfterClass
139155
public static void tearDown()
140156
{
141-
if (s_cluster != null)
157+
if (s_storage1 != null)
142158
{
143-
s_cluster.close();
159+
s_storage1.close();
160+
}
161+
if (s_storage2 != null)
162+
{
163+
s_storage2.close();
144164
}
145165
}
146166

@@ -293,7 +313,9 @@ protected String getPrincipalName(KeyTool.KeyAndCert keyAndCert)
293313

294314
protected static KeyTool.KeyAndCert s_keyAndCertMissing;
295315

296-
protected static CoherenceCluster s_cluster;
316+
protected static CoherenceClusterMember s_storage1;
317+
318+
protected static CoherenceClusterMember s_storage2;
297319

298320
@ClassRule
299321
public static TestLogs s_testLogs = new TestLogs(CertSecuritySingleStoreTests.class);

0 commit comments

Comments
 (0)