Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/super-linter.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FILTER_REGEX_EXCLUDE=mvnw|src/main/generated/.*|docs/themes/.*|keystore.pkcs12|.*.java|prometheus-metrics-exporter-opentelemetry-shaded/pom.xml|CODE_OF_CONDUCT.md|CLAUDE.md|CODE_QUALITY_IMPROVEMENTS.md
FILTER_REGEX_EXCLUDE=mvnw|src/main/generated/.*|docs/themes/.*|keystore.pkcs12|.*.java|prometheus-metrics-exporter-opentelemetry-shaded/pom.xml|CODE_OF_CONDUCT.md|CLAUDE.md
IGNORE_GITIGNORED_FILES=true
JAVA_FILE_NAME=google_checks.xml
LOG_LEVEL=ERROR
Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Pre-built instrumentations: `prometheus-metrics-instrumentation-jvm`, `-caffeine
- JUnit 5 (Jupiter) with `@Test` annotations
- AssertJ for fluent assertions
- Mockito for mocking
- **Test visibility**: Test classes and test methods must be package-protected (no `public` modifier)
- Integration tests are in `integration-tests/` and run during `verify` phase
- Acceptance tests use OATs framework: `mise run acceptance-test`

Expand Down
86 changes: 0 additions & 86 deletions CODE_QUALITY_IMPROVEMENTS.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected void start(String outcome) {
}

@AfterEach
public void tearDown() throws IOException {
void tearDown() throws IOException {
sampleAppContainer.stop();
sampleAppVolume.remove();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public ExporterIT(String sampleApp) throws IOException, URISyntaxException {
}

@Test
public void testOpenMetricsTextFormat() throws IOException {
void testOpenMetricsTextFormat() throws IOException {
start();
Response response =
scrape("GET", "", "Accept", "application/openmetrics-text; version=1.0.0; charset=utf-8");
Expand All @@ -44,7 +44,7 @@ public void testOpenMetricsTextFormat() throws IOException {
}

@Test
public void testPrometheusTextFormat() throws IOException {
void testPrometheusTextFormat() throws IOException {
start();
Response response = scrape("GET", "");
assertThat(response.status).isEqualTo(200);
Expand All @@ -64,7 +64,7 @@ public void testPrometheusTextFormat() throws IOException {
}

@Test
public void testPrometheusProtobufFormat() throws IOException {
void testPrometheusProtobufFormat() throws IOException {
start();
Response response =
scrape(
Expand Down Expand Up @@ -121,7 +121,7 @@ public void testPrometheusProtobufDebugFormat(String format, String expected) th
}

@Test
public void testCompression() throws IOException {
void testCompression() throws IOException {
start();
Response response =
scrape(
Expand Down Expand Up @@ -149,15 +149,15 @@ public void testCompression() throws IOException {
}

@Test
public void testErrorHandling() throws IOException {
void testErrorHandling() throws IOException {
start("error");
Response response = scrape("GET", "");
assertThat(response.status).isEqualTo(500);
assertThat(response.stringBody()).contains("Simulating an error.");
}

@Test
public void testHeadRequest() throws IOException {
void testHeadRequest() throws IOException {
start();
Response fullResponse = scrape("GET", "");
int size = fullResponse.body.length;
Expand All @@ -169,7 +169,7 @@ public void testHeadRequest() throws IOException {
}

@Test
public void testDebug() throws IOException {
void testDebug() throws IOException {
start();
Response response = scrape("GET", "debug=openmetrics");
assertThat(response.status).isEqualTo(200);
Expand All @@ -180,7 +180,7 @@ public void testDebug() throws IOException {
}

@Test
public void testNameFilter() throws IOException {
void testNameFilter() throws IOException {
start();
Response response =
scrape(
Expand All @@ -199,7 +199,7 @@ public void testNameFilter() throws IOException {
}

@Test
public void testEmptyResponseOpenMetrics() throws IOException {
void testEmptyResponseOpenMetrics() throws IOException {
start();
Response response =
scrape(
Expand All @@ -217,7 +217,7 @@ public void testEmptyResponseOpenMetrics() throws IOException {
}

@Test
public void testEmptyResponseText() throws IOException {
void testEmptyResponseText() throws IOException {
start();
Response response = scrape("GET", nameParam("none_existing"));
assertThat(response.status).isEqualTo(200);
Expand All @@ -231,7 +231,7 @@ public void testEmptyResponseText() throws IOException {
}

@Test
public void testEmptyResponseProtobuf() throws IOException {
void testEmptyResponseProtobuf() throws IOException {
start();
Response response =
scrape(
Expand All @@ -249,7 +249,7 @@ public void testEmptyResponseProtobuf() throws IOException {
}

@Test
public void testEmptyResponseGzipOpenMetrics() throws IOException {
void testEmptyResponseGzipOpenMetrics() throws IOException {
start();
Response response =
scrape(
Expand All @@ -265,7 +265,7 @@ public void testEmptyResponseGzipOpenMetrics() throws IOException {
}

@Test
public void testEmptyResponseGzipText() throws IOException {
void testEmptyResponseGzipText() throws IOException {
start();
Response response = scrape("GET", nameParam("none_existing"), "Accept-Encoding", "gzip");
assertThat(response.status).isEqualTo(200);
Expand All @@ -278,7 +278,7 @@ private String nameParam(String name) {
}

@Test
public void testDebugUnknown() throws IOException {
void testDebugUnknown() throws IOException {
start();
Response response = scrape("GET", "debug=unknown");
assertThat(response.status).isEqualTo(500);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public NoProtobufIT() throws IOException, URISyntaxException {
}

@Test
public void testPrometheusProtobufDebugFormat() throws IOException {
void testPrometheusProtobufDebugFormat() throws IOException {
start();
assertThat(scrape("GET", "debug=text").status).isEqualTo(200);
// protobuf is not supported
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.utility.MountableFile;

public class PushGatewayIT {
class PushGatewayIT {

private GenericContainer<?> sampleAppContainer;
private GenericContainer<?> pushGatewayContainer;
private GenericContainer<?> prometheusContainer;
private Volume sampleAppVolume;

@BeforeEach
public void setUp() throws IOException, URISyntaxException {
void setUp() throws IOException, URISyntaxException {
Network network = Network.newNetwork();
sampleAppVolume = Volume.create("it-pushgateway").copy("pushgateway-test-app.jar");
pushGatewayContainer =
Expand All @@ -56,7 +56,7 @@ public void setUp() throws IOException, URISyntaxException {
}

@AfterEach
public void tearDown() throws IOException {
void tearDown() throws IOException {
prometheusContainer.stop();
pushGatewayContainer.stop();
sampleAppContainer.stop();
Expand All @@ -66,7 +66,7 @@ public void tearDown() throws IOException {
final OkHttpClient client = new OkHttpClient();

@Test
public void testSimple() throws IOException, InterruptedException {
void testSimple() throws IOException, InterruptedException {
pushGatewayContainer.start();
sampleAppContainer
.withCommand(
Expand All @@ -86,7 +86,7 @@ public void testSimple() throws IOException, InterruptedException {
}

@Test
public void testTextFormat() throws IOException, InterruptedException {
void testTextFormat() throws IOException, InterruptedException {
pushGatewayContainer.start();
sampleAppContainer
.withCommand(
Expand All @@ -106,7 +106,7 @@ public void testTextFormat() throws IOException, InterruptedException {
}

@Test
public void testBasicAuth() throws IOException, InterruptedException {
void testBasicAuth() throws IOException, InterruptedException {
pushGatewayContainer
.withCopyFileToContainer(
MountableFile.forClasspathResource("/pushgateway-basicauth.yaml"),
Expand All @@ -131,7 +131,7 @@ public void testBasicAuth() throws IOException, InterruptedException {
}

@Test
public void testSsl() throws InterruptedException, IOException {
void testSsl() throws InterruptedException, IOException {
pushGatewayContainer
.withCopyFileToContainer(
MountableFile.forClasspathResource("/pushgateway-ssl.yaml"),
Expand All @@ -156,7 +156,7 @@ public void testSsl() throws InterruptedException, IOException {
}

@Test
public void testProtobuf() throws IOException, InterruptedException {
void testProtobuf() throws IOException, InterruptedException {
pushGatewayContainer.start();
sampleAppContainer
.withCommand(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
class ApplicationTest {
@Test
public void testPrometheusProtobufFormat() throws IOException {
void testPrometheusProtobufFormat() throws IOException {
ExporterTest.Response response =
ExporterTest.scrape(
"GET",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class PrometheusPropertiesLoaderTest {

@Test
public void propertiesShouldBeLoadedFromPropertiesFile() {
void propertiesShouldBeLoadedFromPropertiesFile() {
PrometheusProperties prometheusProperties = PrometheusPropertiesLoader.load();
assertThat(prometheusProperties.getDefaultMetricProperties().getHistogramClassicUpperBounds())
.hasSize(11);
Expand All @@ -38,7 +38,7 @@ void cantLoadPropertiesFile() {
}

@Test
public void externalPropertiesShouldOverridePropertiesFile() {
void externalPropertiesShouldOverridePropertiesFile() {
Properties properties = new Properties();
properties.setProperty("io.prometheus.metrics.histogramClassicUpperBounds", ".005, .01");
properties.setProperty(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
class PrometheusPropertiesTest {

@Test
public void testPrometheusConfig() {
void testPrometheusConfig() {
PrometheusProperties result = PrometheusProperties.get();
assertThat(result.getDefaultMetricProperties().getHistogramClassicUpperBounds()).hasSize(11);
assertThat(result.getMetricProperties("http_duration_seconds").getHistogramClassicUpperBounds())
.hasSize(4);
}

@Test
public void testEmptyUpperBounds() throws IOException {
void testEmptyUpperBounds() throws IOException {
Properties properties = new Properties();
try (InputStream stream =
Thread.currentThread()
Expand All @@ -34,7 +34,7 @@ public void testEmptyUpperBounds() throws IOException {
}

@Test
public void testBuilder() {
void testBuilder() {
PrometheusProperties defaults = PrometheusPropertiesLoader.load(new HashMap<>());
PrometheusProperties.Builder builder = PrometheusProperties.builder();
builder.defaultMetricsProperties(defaults.getDefaultMetricProperties());
Expand Down
Loading