Skip to content

Commit 4581bca

Browse files
committed
Bug 38084318 - Build: Intermittent Topics channel count test failure
(merge main -> ce/main 117096) [git-p4: depot-paths = "//dev/coherence-ce/main/": change = 117097]
1 parent 90659e5 commit 4581bca

File tree

3 files changed

+48
-23
lines changed

3 files changed

+48
-23
lines changed

prj/coherence-bedrock/coherence-bedrock-testing-support/src/main/java/com/oracle/bedrock/junit/CoherenceClusterResource.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2025, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
55
* https://oss.oracle.com/licenses/upl.
@@ -79,7 +79,7 @@ public CoherenceCluster getCluster()
7979

8080

8181
@Override
82-
protected void before() throws Throwable
82+
public void before() throws Throwable
8383
{
8484
if (launchDefinitions.isEmpty())
8585
{
@@ -100,7 +100,7 @@ protected void before() throws Throwable
100100

101101

102102
@Override
103-
protected void after()
103+
public void after()
104104
{
105105
// clean up the sessions
106106
synchronized (f_mapCCF)

prj/test/functional/topics/src/main/java/topics/AbstractTopicChannelCountTests.java

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/*
3-
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
3+
* Copyright (c) 2000, 2025, Oracle and/or its affiliates.
44
*
55
* Licensed under the Universal Permissive License v 1.0 as shown at
66
* https://oss.oracle.com/licenses/upl.
@@ -13,6 +13,7 @@
1313
import com.oracle.bedrock.runtime.coherence.options.CacheConfig;
1414
import com.oracle.bedrock.runtime.coherence.options.ClusterName;
1515
import com.oracle.bedrock.runtime.coherence.options.LocalHost;
16+
import com.oracle.bedrock.runtime.coherence.options.LocalStorage;
1617
import com.oracle.bedrock.runtime.coherence.options.Logging;
1718
import com.oracle.bedrock.runtime.coherence.options.RoleName;
1819
import com.oracle.bedrock.runtime.coherence.options.WellKnownAddress;
@@ -35,6 +36,8 @@
3536
import com.tangosol.net.topic.Publisher;
3637
import com.tangosol.net.topic.Subscriber;
3738
import org.junit.After;
39+
import org.junit.Before;
40+
import org.junit.BeforeClass;
3841
import org.junit.ClassRule;
3942
import org.junit.Ignore;
4043
import org.junit.Rule;
@@ -72,12 +75,45 @@
7275
@SuppressWarnings({"resource", "unchecked"})
7376
public abstract class AbstractTopicChannelCountTests
7477
{
78+
@BeforeClass
79+
public static void setup()
80+
{
81+
System.setProperty(LocalStorage.PROPERTY, "false");
82+
}
83+
84+
@Before
85+
public void startCluster() throws Throwable
86+
{
87+
if (m_cluster != null)
88+
{
89+
m_cluster.getCluster().close();
90+
}
91+
92+
m_cluster = new CoherenceClusterResource()
93+
.with(ClusterName.of(m_testWatcher.getMethodName()),
94+
Logging.atMax(),
95+
LocalHost.only(),
96+
WellKnownAddress.loopback(),
97+
IPv4Preferred.yes())
98+
.include(STORAGE_MEMBER_COUNT,
99+
CoherenceClusterMember.class,
100+
CacheConfig.of(CACHE_CONFIG_FILE),
101+
SystemProperty.of(PROP_CHANNELS, STORAGE_CHANNEL_COUNT),
102+
DisplayName.of("Storage"),
103+
RoleName.of("storage"),
104+
JmxFeature.enabled(),
105+
m_testLogs.builder());
106+
107+
m_cluster.before();
108+
}
109+
75110
@After
76111
public void cleanup()
77112
{
78113
Cluster cluster = CacheFactory.getCluster();
79114
CacheFactory.shutdown();
80115
Eventually.assertDeferred(cluster::isRunning, is(false));
116+
m_cluster.after();
81117
}
82118

83119
@Test
@@ -852,20 +888,5 @@ public String toString()
852888
@Rule(order = 1)
853889
public TestName m_testWatcher = new TestName();
854890

855-
@Rule(order = 2)
856-
public CoherenceClusterResource m_cluster =
857-
new CoherenceClusterResource()
858-
.with(ClusterName.of(m_testWatcher.getMethodName()),
859-
Logging.atMax(),
860-
LocalHost.only(),
861-
WellKnownAddress.loopback(),
862-
IPv4Preferred.yes())
863-
.include(STORAGE_MEMBER_COUNT,
864-
CoherenceClusterMember.class,
865-
CacheConfig.of(CACHE_CONFIG_FILE),
866-
SystemProperty.of(PROP_CHANNELS, STORAGE_CHANNEL_COUNT),
867-
DisplayName.of("Storage"),
868-
RoleName.of("storage"),
869-
JmxFeature.enabled(),
870-
m_testLogs.builder());
891+
public CoherenceClusterResource m_cluster;
871892
}

prj/test/functional/topics/src/main/java/topics/callables/GetChannelsWithMessages.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/*
2-
* Copyright (c) 2000, 2022, Oracle and/or its affiliates.
2+
* Copyright (c) 2000, 2025, Oracle and/or its affiliates.
33
*
44
* Licensed under the Universal Permissive License v 1.0 as shown at
55
* https://oss.oracle.com/licenses/upl.
66
*/
77
package topics.callables;
88

99
import com.oracle.bedrock.runtime.concurrent.RemoteCallable;
10+
import com.oracle.coherence.common.base.Logger;
1011
import com.tangosol.internal.net.topic.impl.paged.PagedTopicCaches;
1112
import com.tangosol.internal.net.topic.impl.paged.model.Page;
1213
import com.tangosol.net.Coherence;
@@ -31,14 +32,17 @@ public GetChannelsWithMessages(String sTopicName)
3132
@Override
3233
public Set<Integer> call() throws Exception
3334
{
35+
Logger.info("Invoking GetChannelsWithMessages");
3436
Session session = Coherence.getInstance().getSession();
3537
NamedTopic<?> topic = session.getTopic(m_sTopicName);
36-
PagedTopicCaches caches = new PagedTopicCaches(m_sTopicName, (PagedTopicService) topic.getService());
38+
PagedTopicCaches caches = new PagedTopicCaches(m_sTopicName, (PagedTopicService) topic.getService(), false);
3739

38-
return caches.Pages.keySet()
40+
Set<Integer> set = caches.Pages.keySet()
3941
.stream()
4042
.map(Page.Key::getChannelId)
4143
.collect(Collectors.toSet());
44+
Logger.info("Invoked GetChannelsWithMessages, result=" + set);
45+
return set;
4246
}
4347

4448
private final String m_sTopicName;

0 commit comments

Comments
 (0)