Skip to content

Commit

Permalink
Update patch with current state
Browse files Browse the repository at this point in the history
  • Loading branch information
rickie committed Dec 20, 2024
1 parent c6cad43 commit b4c5bed
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 21 deletions.
44 changes: 36 additions & 8 deletions integration-tests/prometheus-java-client-expected-changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4511,10 +4511,10 @@
testCase.systemProperties.keySet().forEach(System::clearProperty);
--- a/prometheus-metrics-exporter-opentelemetry/src/test/java/io/prometheus/metrics/exporter/opentelemetry/PrometheusInstrumentationScopeTest.java
+++ b/prometheus-metrics-exporter-opentelemetry/src/test/java/io/prometheus/metrics/exporter/opentelemetry/PrometheusInstrumentationScopeTest.java
@@ -1,22 +1,23 @@
@@ -1,40 +1,40 @@
package io.prometheus.metrics.exporter.opentelemetry;

import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.*;

Expand All @@ -4538,7 +4538,33 @@
+ .hasMessage(
"Prometheus metrics library initialization error: Failed to read path from classpath.");

assertThatExceptionOfType(IllegalStateException.class)
- assertThatExceptionOfType(IllegalStateException.class)
- .isThrownBy(
+ assertThatThrownBy(
() ->
PrometheusInstrumentationScope.loadInstrumentationScopeInfo(
"instrumentationScope.properties", "name", "version"))
- .havingRootCause()
- .withMessage(
+ .isInstanceOf(IllegalStateException.class)
+ .rootCause()
+ .hasMessage(
"Prometheus metrics library initialization error: name not found in instrumentationScope.properties in classpath.");

- assertThatExceptionOfType(IllegalStateException.class)
- .isThrownBy(
+ assertThatThrownBy(
() ->
PrometheusInstrumentationScope.loadInstrumentationScopeInfo(
"instrumentationScope.properties", "instrumentationScope.name", "version"))
- .havingRootCause()
- .withMessage(
+ .isInstanceOf(IllegalStateException.class)
+ .rootCause()
+ .hasMessage(
"Prometheus metrics library initialization error: version not found in instrumentationScope.properties in classpath.");
}
}
--- a/prometheus-metrics-exporter-opentelemetry/src/test/java/io/prometheus/metrics/exporter/opentelemetry/otelmodel/PrometheusMetricDataTest.java
+++ b/prometheus-metrics-exporter-opentelemetry/src/test/java/io/prometheus/metrics/exporter/opentelemetry/otelmodel/PrometheusMetricDataTest.java
@@ -7,7 +7,7 @@ import io.prometheus.metrics.model.snapshots.Unit;
Expand Down Expand Up @@ -9448,7 +9474,7 @@
}
--- a/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/MetricSnapshotTest.java
+++ b/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/MetricSnapshotTest.java
@@ -2,14 +2,15 @@ package io.prometheus.metrics.model.snapshots;
@@ -2,15 +2,16 @@ package io.prometheus.metrics.model.snapshots;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
Expand All @@ -9459,14 +9485,15 @@
-class MetricSnapshotTest {
+final class MetricSnapshotTest {

// XXX: Investigate the `satisfies` and how to rewrite this.
@SuppressWarnings("AssertThatThrownBy")
@Test
- public void testDuplicateLabels() {
+ void duplicateLabels() {
assertThatExceptionOfType(DuplicateLabelsException.class)
.isThrownBy(
() ->
@@ -40,14 +41,14 @@ class MetricSnapshotTest {
@@ -41,14 +42,14 @@ class MetricSnapshotTest {
}

@Test
Expand Down Expand Up @@ -9628,7 +9655,7 @@
}
--- a/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java
+++ b/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java
@@ -2,12 +2,12 @@ package io.prometheus.metrics.model.snapshots;
@@ -2,13 +2,13 @@ package io.prometheus.metrics.model.snapshots;

import static io.prometheus.metrics.model.snapshots.PrometheusNaming.*;
import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -9637,13 +9664,14 @@

import org.junit.jupiter.api.Test;

// XXX: Fix this edge case in the `JUnitMethodDeclaration` check.
@SuppressWarnings("JUnitMethodDeclaration")
-class PrometheusNamingTest {
+final class PrometheusNamingTest {

@Test
public void testSanitizeMetricName() {
@@ -26,19 +26,19 @@ class PrometheusNamingTest {
@@ -27,19 +27,19 @@ class PrometheusNamingTest {
@Test
public void testSanitizeMetricNameWithUnit() {
assertThat(prometheusName(sanitizeMetricName("0abc.def", Unit.RATIO)))
Expand Down Expand Up @@ -9673,7 +9701,7 @@
}

@Test
@@ -76,25 +76,23 @@ class PrometheusNamingTest {
@@ -77,25 +77,23 @@ class PrometheusNamingTest {

@Test
public void testInvalidUnitName1() {
Expand Down
15 changes: 2 additions & 13 deletions integration-tests/prometheus-java-client-init.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
diff --git a/pom.xml b/pom.xml
index 2f9aa6df..ee45a2b1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,7 @@
Expand Down Expand Up @@ -53,8 +51,6 @@ index 2f9aa6df..ee45a2b1 100644
</path>
<!-- Other annotation processors go here.

diff --git a/prometheus-metrics-exporter-opentelemetry/src/test/java/io/prometheus/metrics/exporter/opentelemetry/PrometheusInstrumentationScopeTest.java b/prometheus-metrics-exporter-opentelemetry/src/test/java/io/prometheus/metrics/exporter/opentelemetry/PrometheusInstrumentationScopeTest.java
index e1b97e04..27c1f990 100644
--- a/prometheus-metrics-exporter-opentelemetry/src/test/java/io/prometheus/metrics/exporter/opentelemetry/PrometheusInstrumentationScopeTest.java
+++ b/prometheus-metrics-exporter-opentelemetry/src/test/java/io/prometheus/metrics/exporter/opentelemetry/PrometheusInstrumentationScopeTest.java
@@ -7,6 +7,8 @@ import org.junit.jupiter.api.Test;
Expand All @@ -66,8 +62,6 @@ index e1b97e04..27c1f990 100644
@Test
void loadInstrumentationScopeInfo() {
assertThatExceptionOfType(IllegalStateException.class)
diff --git a/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/MetricNameFilter.java b/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/MetricNameFilter.java
index 59fbe6a1..075f586f 100644
--- a/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/MetricNameFilter.java
+++ b/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/MetricNameFilter.java
@@ -8,6 +8,8 @@ import java.util.Collection;
Expand All @@ -79,8 +73,6 @@ index 59fbe6a1..075f586f 100644
public class MetricNameFilter implements Predicate<String> {

/** For convenience, a filter that allows all names. */
diff --git a/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Quantiles.java b/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Quantiles.java
index 34a9bc04..41dc7eac 100644
--- a/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Quantiles.java
+++ b/prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Quantiles.java
@@ -41,6 +41,8 @@ public class Quantiles implements Iterable<Quantile> {
Expand All @@ -92,20 +84,17 @@ index 34a9bc04..41dc7eac 100644
public static Quantiles of(Quantile... quantiles) {
return of(Arrays.asList(quantiles));
}
diff --git a/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/MetricSnapshotTest.java b/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/MetricSnapshotTest.java
index 2c1c04bb..79ee6e1d 100644
--- a/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/MetricSnapshotTest.java
+++ b/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/MetricSnapshotTest.java
@@ -7,6 +7,7 @@ import org.junit.jupiter.api.Test;
@@ -7,6 +7,8 @@ import org.junit.jupiter.api.Test;

class MetricSnapshotTest {

+ // XXX: Investigate the `satisfies` and how to rewrite this.
+ @SuppressWarnings("AssertThatThrownBy")
@Test
public void testDuplicateLabels() {
assertThatExceptionOfType(DuplicateLabelsException.class)
diff --git a/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java b/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java
index fad55e0a..c3b56e16 100644
--- a/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java
+++ b/prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/PrometheusNamingTest.java
@@ -6,6 +6,8 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
Expand Down

0 comments on commit b4c5bed

Please sign in to comment.