Skip to content

Commit b267fb7

Browse files
committed
Bug 37467967 - [37355933->25.03] Build: CESJavaSingleClusterTests.shouldUseDefaultExecutor (merge main -> ce/main @ 113362)
[git-p4: depot-paths = "//dev/coherence-ce/main/": change = 113363]
1 parent df90244 commit b267fb7

File tree

2 files changed

+35
-10
lines changed

2 files changed

+35
-10
lines changed

prj/coherence-core/src/main/java/com/tangosol/internal/net/topic/NamedTopicPublisher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2024, 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.

prj/test/functional/executor/src/main/java/executor/CESJavaSingleClusterTests.java

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2024, 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.
@@ -25,28 +25,31 @@
2525
import com.oracle.bedrock.runtime.options.StabilityPredicate;
2626
import com.oracle.bedrock.testsupport.deferred.Eventually;
2727

28-
import com.tangosol.internal.net.metrics.MetricsHttpHelper;
28+
import com.tangosol.discovery.NSLookup;
29+
2930
import com.tangosol.net.Coherence;
3031

3132
import executor.common.CoherenceClusterResource;
3233
import executor.common.LogOutput;
3334
import executor.common.SingleClusterForAllTests;
3435
import executor.common.Utils;
3536

37+
import java.net.InetSocketAddress;
38+
import java.net.URL;
39+
3640
import metrics.AbstractMetricsFunctionalTest;
3741

3842
import java.util.LinkedHashMap;
3943
import java.util.Map;
4044

41-
import org.hamcrest.CoreMatchers;
42-
4345
import org.junit.BeforeClass;
4446
import org.junit.ClassRule;
4547
import org.junit.Test;
48+
4649
import org.junit.experimental.categories.Category;
4750

48-
import static com.oracle.bedrock.deferred.DeferredHelper.invoking;
49-
import static org.hamcrest.Matchers.greaterThan;
51+
import static org.hamcrest.CoreMatchers.is;
52+
5053
import static org.junit.Assert.fail;
5154

5255

@@ -97,18 +100,35 @@ public String getLabel()
97100
public void shouldUseDefaultExecutor()
98101
{
99102
Utils.assertWithFailureAction(super::shouldUseDefaultExecutor, this::dumpExecutorCacheStates);
103+
Utils.assertWithFailureAction(this::validateMetrics, this::dumpExecutorCacheStates);
104+
}
105+
106+
// ----- helper methods -------------------------------------------------
100107

108+
protected void validateMetrics()
109+
{
110+
Eventually.assertDeferred(this::getCompletedMetricsAggregate, is(23L));
111+
}
112+
113+
protected long getCompletedMetricsAggregate()
114+
{
101115
AbstractMetricsFunctionalTest metricsHelper = new AbstractMetricsFunctionalTest();
102116
Map<String, String> tags = new LinkedHashMap<>();
117+
long clInvoked = 0;
103118

104119
try
105120
{
106-
Eventually.assertThat(invoking(metricsHelper).getCacheMetric(s_metrics_port, "Coherence.Executor.TasksCompletedCount", tags), CoreMatchers.is(greaterThan(4L)));
121+
for (URL url : NSLookup.lookupHTTPMetricsURL(new InetSocketAddress("127.0.0.1", 7778)))
122+
{
123+
clInvoked += metricsHelper.getCacheMetric(url.getPort(), TASK_COMP_COUNT_METRIC, tags);
124+
}
107125
}
108126
catch (Exception e)
109127
{
110128
fail("Get Executor metrics failed with exception: " + e);
111129
}
130+
131+
return clInvoked;
112132
}
113133

114134
// ----- constants ------------------------------------------------------
@@ -117,7 +137,9 @@ public void shouldUseDefaultExecutor()
117137

118138
protected static final String METRICS_ENABLED_PROPERTY = "coherence.metrics.http.enabled";
119139

120-
protected static int s_metrics_port = MetricsHttpHelper.DEFAULT_PROMETHEUS_METRICS_PORT;
140+
protected static final String METRICS_PORT_PROPERTY = "coherence.metrics.http.port";
141+
142+
protected static final String TASK_COMP_COUNT_METRIC = "Coherence.Executor.TasksCompletedCount";
121143

122144
// ----- data members ---------------------------------------------------
123145

@@ -136,6 +158,7 @@ public void shouldUseDefaultExecutor()
136158
ClusterName.of(CESJavaSingleClusterTests.class.getSimpleName()), // default name is too long
137159
SystemProperty.of(EXTEND_ADDRESS_PROPERTY, EXTEND_HOST),
138160
SystemProperty.of(EXTEND_PORT_PROPERTY, EXTEND_PORT),
161+
SystemProperty.of(METRICS_PORT_PROPERTY, "0"),
139162
JmxFeature.enabled(),
140163
StabilityPredicate.of(CoherenceCluster.Predicates.isCoherenceRunning()))
141164
.include(STORAGE_ENABLED_MEMBER_COUNT,
@@ -144,21 +167,23 @@ public void shouldUseDefaultExecutor()
144167
RoleName.of(STORAGE_ENABLED_MEMBER_ROLE),
145168
LocalStorage.enabled(),
146169
SystemProperty.of(EXTEND_ENABLED_PROPERTY, false),
170+
SystemProperty.of(METRICS_ENABLED_PROPERTY, true),
147171
SystemProperty.of(EXECUTOR_LOGGING_PROPERTY, true))
148172
.include(STORAGE_DISABLED_MEMBER_COUNT,
149173
DisplayName.of("ComputeServer"),
150174
LogOutput.to(CESJavaSingleClusterTests.class.getSimpleName(), "ComputeServer"),
151175
RoleName.of(STORAGE_DISABLED_MEMBER_ROLE),
152176
LocalStorage.disabled(),
153-
SystemProperty.of(METRICS_ENABLED_PROPERTY, true),
154177
SystemProperty.of(EXTEND_ENABLED_PROPERTY, false),
178+
SystemProperty.of(METRICS_ENABLED_PROPERTY, true),
155179
SystemProperty.of(EXECUTOR_LOGGING_PROPERTY, true))
156180
.include(PROXY_MEMBER_COUNT,
157181
DisplayName.of("ProxyServer"),
158182
LogOutput.to(CESJavaSingleClusterTests.class.getSimpleName(), "ProxyServer"),
159183
RoleName.of(PROXY_MEMBER_ROLE),
160184
LocalStorage.disabled(),
161185
SystemProperty.of(EXTEND_ENABLED_PROPERTY, true),
186+
SystemProperty.of(METRICS_ENABLED_PROPERTY, true),
162187
SystemProperty.of(EXECUTOR_LOGGING_PROPERTY, true));
163188
}
164189

0 commit comments

Comments
 (0)