|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. |
| 2 | + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. |
3 | 3 | *
|
4 | 4 | * Licensed under the Universal Permissive License v 1.0 as shown at
|
5 | 5 | * https://oss.oracle.com/licenses/upl.
|
|
18 | 18 | import com.oracle.bedrock.runtime.coherence.options.RoleName;
|
19 | 19 |
|
20 | 20 | import com.oracle.bedrock.runtime.java.features.JmxFeature;
|
21 |
| - |
22 | 21 | import com.oracle.bedrock.runtime.java.options.ClassName;
|
23 | 22 | import com.oracle.bedrock.runtime.java.options.SystemProperty;
|
24 | 23 |
|
25 | 24 | import com.oracle.bedrock.runtime.options.DisplayName;
|
26 |
| - |
27 | 25 | import com.oracle.bedrock.runtime.options.StabilityPredicate;
|
| 26 | +import com.oracle.bedrock.testsupport.deferred.Eventually; |
| 27 | + |
| 28 | +import com.tangosol.internal.net.metrics.MetricsHttpHelper; |
28 | 29 | import com.tangosol.net.Coherence;
|
29 | 30 |
|
30 | 31 | import executor.common.CoherenceClusterResource;
|
31 | 32 | import executor.common.LogOutput;
|
32 | 33 | import executor.common.SingleClusterForAllTests;
|
| 34 | +import executor.common.Utils; |
| 35 | + |
| 36 | +import metrics.AbstractMetricsFunctionalTest; |
| 37 | + |
| 38 | +import java.util.LinkedHashMap; |
| 39 | +import java.util.Map; |
| 40 | + |
| 41 | +import org.hamcrest.CoreMatchers; |
33 | 42 |
|
34 |
| -import org.junit.AfterClass; |
35 | 43 | import org.junit.BeforeClass;
|
36 | 44 | import org.junit.ClassRule;
|
37 |
| - |
| 45 | +import org.junit.Test; |
38 | 46 | import org.junit.experimental.categories.Category;
|
39 | 47 |
|
| 48 | +import static com.oracle.bedrock.deferred.DeferredHelper.invoking; |
| 49 | +import static org.hamcrest.Matchers.greaterThan; |
| 50 | +import static org.junit.Assert.fail; |
| 51 | + |
| 52 | + |
40 | 53 | /**
|
41 | 54 | * Tests will spin up a cluster shared by each test using java as the serialization
|
42 | 55 | * format.
|
@@ -78,10 +91,34 @@ public String getLabel()
|
78 | 91 | return CESJavaSingleClusterTests.class.getSimpleName();
|
79 | 92 | }
|
80 | 93 |
|
| 94 | + // Add Executor metrics verification. |
| 95 | + @Override |
| 96 | + @Test(timeout = 300000) // timeout after five minutes |
| 97 | + public void shouldUseDefaultExecutor() |
| 98 | + { |
| 99 | + Utils.assertWithFailureAction(super::shouldUseDefaultExecutor, this::dumpExecutorCacheStates); |
| 100 | + |
| 101 | + AbstractMetricsFunctionalTest metricsHelper = new AbstractMetricsFunctionalTest(); |
| 102 | + Map<String, String> tags = new LinkedHashMap<>(); |
| 103 | + |
| 104 | + try |
| 105 | + { |
| 106 | + Eventually.assertThat(invoking(metricsHelper).getCacheMetric(s_metrics_port, "Coherence.Executor.TasksCompletedCount", tags), CoreMatchers.is(greaterThan(4L))); |
| 107 | + } |
| 108 | + catch (Exception e) |
| 109 | + { |
| 110 | + fail("Get Executor metrics failed with exception: " + e); |
| 111 | + } |
| 112 | + } |
| 113 | + |
81 | 114 | // ----- constants ------------------------------------------------------
|
82 | 115 |
|
83 | 116 | protected static final String EXTEND_CONFIG = "coherence-concurrent-client-config.xml";
|
84 | 117 |
|
| 118 | + protected static final String METRICS_ENABLED_PROPERTY = "coherence.metrics.http.enabled"; |
| 119 | + |
| 120 | + protected static int s_metrics_port = MetricsHttpHelper.DEFAULT_PROMETHEUS_METRICS_PORT; |
| 121 | + |
85 | 122 | // ----- data members ---------------------------------------------------
|
86 | 123 |
|
87 | 124 | /**
|
@@ -113,6 +150,7 @@ public String getLabel()
|
113 | 150 | LogOutput.to(CESJavaSingleClusterTests.class.getSimpleName(), "ComputeServer"),
|
114 | 151 | RoleName.of(STORAGE_DISABLED_MEMBER_ROLE),
|
115 | 152 | LocalStorage.disabled(),
|
| 153 | + SystemProperty.of(METRICS_ENABLED_PROPERTY, true), |
116 | 154 | SystemProperty.of(EXTEND_ENABLED_PROPERTY, false),
|
117 | 155 | SystemProperty.of(EXECUTOR_LOGGING_PROPERTY, true))
|
118 | 156 | .include(PROXY_MEMBER_COUNT,
|
|
0 commit comments