-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Doug Hoard <doug.hoard@gmail.com>
- Loading branch information
Showing
22 changed files
with
402 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
..._suite/integration_tests/src/test/java/io/prometheus/jmx/test/ExcludeObjectNamesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright (C) 2023 The Prometheus jmx_exporter Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.prometheus.jmx.test; | ||
|
||
import io.prometheus.jmx.test.support.ContentConsumer; | ||
import io.prometheus.jmx.test.support.HealthyRequest; | ||
import io.prometheus.jmx.test.support.HealthyResponse; | ||
import io.prometheus.jmx.test.support.MetricsRequest; | ||
import io.prometheus.jmx.test.support.MetricsResponse; | ||
import io.prometheus.jmx.test.support.OpenMetricsRequest; | ||
import io.prometheus.jmx.test.support.OpenMetricsResponse; | ||
import io.prometheus.jmx.test.support.PrometheusMetricsRequest; | ||
import io.prometheus.jmx.test.support.PrometheusMetricsResponse; | ||
import io.prometheus.jmx.test.support.RequestResponseAssertions; | ||
import org.antublue.test.engine.api.TestEngine; | ||
|
||
import java.util.Collection; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class ExcludeObjectNamesTest extends BaseTest implements ContentConsumer { | ||
|
||
@TestEngine.Test | ||
public void testHealthy() { | ||
RequestResponseAssertions | ||
.assertThatResponseForRequest(new HealthyRequest(testState.httpClient())) | ||
.isSuperset(HealthyResponse.RESULT_200); | ||
} | ||
|
||
@TestEngine.Test | ||
public void testMetrics() { | ||
RequestResponseAssertions | ||
.assertThatResponseForRequest(new MetricsRequest(testState.httpClient())) | ||
.isSuperset(MetricsResponse.RESULT_200) | ||
.dispatch(this); | ||
} | ||
|
||
@TestEngine.Test | ||
public void testMetricsOpenMetricsFormat() { | ||
RequestResponseAssertions | ||
.assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient())) | ||
.isSuperset(OpenMetricsResponse.RESULT_200) | ||
.dispatch(this); | ||
} | ||
|
||
@TestEngine.Test | ||
public void testMetricsPrometheusFormat() { | ||
RequestResponseAssertions | ||
.assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient())) | ||
.isSuperset(PrometheusMetricsResponse.RESULT_200) | ||
.dispatch(this); | ||
} | ||
|
||
@Override | ||
public void accept(String content) { | ||
Collection<Metric> metricCollection = MetricsParser.parse(content); | ||
|
||
/* | ||
* Assert that we don't have any metrics that start with ... | ||
* | ||
* name = java_lang* | ||
*/ | ||
metricCollection | ||
.forEach(metric -> assertThat(metric.getName().toLowerCase()).doesNotStartWith("java_lang")); | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
...egration_tests/src/test/java/io/prometheus/jmx/test/IncludeAndExcludeObjectNamesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright (C) 2023 The Prometheus jmx_exporter Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.prometheus.jmx.test; | ||
|
||
import io.prometheus.jmx.test.support.ContentConsumer; | ||
import io.prometheus.jmx.test.support.HealthyRequest; | ||
import io.prometheus.jmx.test.support.HealthyResponse; | ||
import io.prometheus.jmx.test.support.MetricsRequest; | ||
import io.prometheus.jmx.test.support.MetricsResponse; | ||
import io.prometheus.jmx.test.support.OpenMetricsRequest; | ||
import io.prometheus.jmx.test.support.OpenMetricsResponse; | ||
import io.prometheus.jmx.test.support.PrometheusMetricsRequest; | ||
import io.prometheus.jmx.test.support.PrometheusMetricsResponse; | ||
import org.antublue.test.engine.api.TestEngine; | ||
|
||
import java.util.Collection; | ||
|
||
import static io.prometheus.jmx.test.support.RequestResponseAssertions.assertThatResponseForRequest; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class IncludeAndExcludeObjectNamesTest extends BaseTest implements ContentConsumer { | ||
|
||
@TestEngine.Test | ||
public void testHealthy() { | ||
assertThatResponseForRequest(new HealthyRequest(testState.httpClient())) | ||
.isSuperset(HealthyResponse.RESULT_200); | ||
} | ||
|
||
@TestEngine.Test | ||
public void testMetrics() { | ||
assertThatResponseForRequest(new MetricsRequest(testState.httpClient())) | ||
.isSuperset(MetricsResponse.RESULT_200) | ||
.dispatch(this); | ||
} | ||
|
||
@TestEngine.Test | ||
public void testMetricsOpenMetricsFormat() { | ||
assertThatResponseForRequest(new OpenMetricsRequest(testState.httpClient())) | ||
.isSuperset(OpenMetricsResponse.RESULT_200) | ||
.dispatch(this); | ||
} | ||
|
||
@TestEngine.Test | ||
public void testMetricsPrometheusFormat() { | ||
assertThatResponseForRequest(new PrometheusMetricsRequest(testState.httpClient())) | ||
.isSuperset(PrometheusMetricsResponse.RESULT_200) | ||
.dispatch(this); | ||
} | ||
|
||
@Override | ||
public void accept(String content) { | ||
Collection<Metric> metricCollection = MetricsParser.parse(content); | ||
|
||
/* | ||
* Assert that we don't have any metrics that start with ... | ||
* | ||
* name = java_lang* | ||
*/ | ||
metricCollection | ||
.forEach(metric -> assertThat(metric.getName().toLowerCase()).doesNotStartWith("java_lang")); | ||
} | ||
} |
Oops, something went wrong.