From 1053651a0b877fbd481da501b76e66f1c96c64ec Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 23 Jul 2026 13:31:23 +0000 Subject: [PATCH 1/2] test: run OATS v0.8.0 consumer suites Signed-off-by: Gregor Zeitlinger --- .github/renovate-tracked-deps.json | 3 +- .../oats-tests/agent/oats-case.yaml | 20 +++++ .../oats-tests/agent/oats.yaml | 12 --- .../agent/service_instance_id_check.py | 52 ----------- .../oats-tests/http/oats-case.yaml | 11 +++ .../oats-tests/http/oats.yaml | 10 --- mise.lock | 89 ++++++++++++++++++- mise.toml | 10 ++- oats-config.yaml | 6 ++ 9 files changed, 132 insertions(+), 81 deletions(-) create mode 100644 examples/example-exporter-opentelemetry/oats-tests/agent/oats-case.yaml delete mode 100644 examples/example-exporter-opentelemetry/oats-tests/agent/oats.yaml delete mode 100755 examples/example-exporter-opentelemetry/oats-tests/agent/service_instance_id_check.py create mode 100644 examples/example-exporter-opentelemetry/oats-tests/http/oats-case.yaml delete mode 100644 examples/example-exporter-opentelemetry/oats-tests/http/oats.yaml create mode 100644 oats-config.yaml diff --git a/.github/renovate-tracked-deps.json b/.github/renovate-tracked-deps.json index 4f3f8c203..513b437c6 100644 --- a/.github/renovate-tracked-deps.json +++ b/.github/renovate-tracked-deps.json @@ -158,11 +158,12 @@ "mise": [ "actionlint", "aqua:grafana/flint", + "aqua:grafana/gcx", + "aqua:grafana/oats", "aqua:jonwiggins/xmloxide", "aqua:owenlamont/ryl", "biome", "editorconfig-checker", - "go:github.com/grafana/oats", "google-java-format", "hugo", "java", diff --git a/examples/example-exporter-opentelemetry/oats-tests/agent/oats-case.yaml b/examples/example-exporter-opentelemetry/oats-tests/agent/oats-case.yaml new file mode 100644 index 000000000..a8a05d0f2 --- /dev/null +++ b/examples/example-exporter-opentelemetry/oats-tests/agent/oats-case.yaml @@ -0,0 +1,20 @@ +name: java agent exporter preserves target_info identity +fixture: + compose: + template: lgtm + file: docker-compose.yml +seed: + type: app +expected: + metrics: + - promql: "uptime_seconds_total{}" + value: ">= 0" + - promql: 'count(target_info{service_name!="otelcol-contrib"})' + value: "== 2" + - promql: 'count(count by (instance) (target_info{service_name!="otelcol-contrib"}))' + value: "== 1" + custom-checks: + - script: | + #!/usr/bin/env bash + set -euo pipefail + curl -fsS "${OATS_GRAFANA_URL:?}/api/health" >/dev/null diff --git a/examples/example-exporter-opentelemetry/oats-tests/agent/oats.yaml b/examples/example-exporter-opentelemetry/oats-tests/agent/oats.yaml deleted file mode 100644 index 899d1cd5d..000000000 --- a/examples/example-exporter-opentelemetry/oats-tests/agent/oats.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# OATS is an acceptance testing framework for OpenTelemetry - -# https://github.com/grafana/oats/tree/main/yaml -oats-schema-version: 2 -docker-compose: - files: - - ./docker-compose.yml -expected: - custom-checks: - - script: ./service_instance_id_check.py - metrics: - - promql: "uptime_seconds_total{}" - value: ">= 0" diff --git a/examples/example-exporter-opentelemetry/oats-tests/agent/service_instance_id_check.py b/examples/example-exporter-opentelemetry/oats-tests/agent/service_instance_id_check.py deleted file mode 100755 index 35ff88b8d..000000000 --- a/examples/example-exporter-opentelemetry/oats-tests/agent/service_instance_id_check.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python3 -""" -Check if the service instance id is present in the exported data. -Returns 0 if the service instance id is present in the exported data. -""" - -import json -import urllib.parse -from urllib.request import urlopen - - -def get_json(url): - with urlopen(url) as response: - return json.loads(response.read().decode("utf-8")) - - -def main(): - # Query Prometheus for target_info - res = get_json("http://localhost:9090/api/v1/query?query=target_info") - - # Uncomment for local debugging - # with open('example_target_info.json') as f: - # res = json.load(f) - - instance_ids = { - r["metric"]["instance"] - for r in res["data"]["result"] - if r["metric"].get("service_name") != "otelcol-contrib" - } - instance_ids = list(instance_ids) - - print(f"Instance ids found:{instance_ids}") - if len(instance_ids) > 1: - print("More than one instance id found") - print(res) - - # Both the agent and the exporter should report the same instance id - assert len(instance_ids) == 1, "Expected exactly one instance id" - - query = f'target_info{{instance="{instance_ids[0]}"}}' - encoded_query = urllib.parse.quote_plus(query) - res = get_json(f"http://localhost:9090/api/v1/query?query={encoded_query}") - - infos = res["data"]["result"] - print(infos) - - # They should not have the same target info (e.g. only the agent has telemetry_distro_name) - assert len(infos) == 2, "Expected two target info results" - - -if __name__ == "__main__": - main() diff --git a/examples/example-exporter-opentelemetry/oats-tests/http/oats-case.yaml b/examples/example-exporter-opentelemetry/oats-tests/http/oats-case.yaml new file mode 100644 index 000000000..fab99dfe3 --- /dev/null +++ b/examples/example-exporter-opentelemetry/oats-tests/http/oats-case.yaml @@ -0,0 +1,11 @@ +name: http protobuf exporter emits uptime metric +fixture: + compose: + template: lgtm + file: docker-compose.yml +seed: + type: app +expected: + metrics: + - promql: "uptime_seconds_total{}" + value: ">= 0" diff --git a/examples/example-exporter-opentelemetry/oats-tests/http/oats.yaml b/examples/example-exporter-opentelemetry/oats-tests/http/oats.yaml deleted file mode 100644 index dbcfcf84f..000000000 --- a/examples/example-exporter-opentelemetry/oats-tests/http/oats.yaml +++ /dev/null @@ -1,10 +0,0 @@ -# OATS is an acceptance testing framework for OpenTelemetry - -# https://github.com/grafana/oats/tree/main/yaml -oats-schema-version: 2 -docker-compose: - files: - - ./docker-compose.yml -expected: - metrics: - - promql: "uptime_seconds_total{}" - value: ">= 0" diff --git a/mise.lock b/mise.lock index 89d88d894..fb15a188d 100644 --- a/mise.lock +++ b/mise.lock @@ -86,6 +86,91 @@ url = "https://github.com/grafana/flint/releases/download/v0.22.7/flint-x86_64-p url_api = "https://api.github.com/repos/grafana/flint/releases/assets/469229804" provenance = "github-attestations" +[[tools."aqua:grafana/gcx"]] +version = "v0.5.0" +backend = "aqua:grafana/gcx" + +[tools."aqua:grafana/gcx"."platforms.linux-arm64"] +checksum = "sha256:07811e994101abf3fe51b7d9d5bbcc045830382ece80f37af29d32234cbe4731" +url = "https://github.com/grafana/gcx/releases/download/v0.5.0/gcx_0.5.0_linux_arm64.tar.gz" +url_api = "https://api.github.com/repos/grafana/gcx/releases/assets/484583603" + +[tools."aqua:grafana/gcx"."platforms.linux-arm64-musl"] +checksum = "sha256:07811e994101abf3fe51b7d9d5bbcc045830382ece80f37af29d32234cbe4731" +url = "https://github.com/grafana/gcx/releases/download/v0.5.0/gcx_0.5.0_linux_arm64.tar.gz" +url_api = "https://api.github.com/repos/grafana/gcx/releases/assets/484583603" + +[tools."aqua:grafana/gcx"."platforms.linux-x64"] +checksum = "sha256:5c0ce026b0625da09ee976115799cba28e6c84375f802c64f7995c0ba87a83b6" +url = "https://github.com/grafana/gcx/releases/download/v0.5.0/gcx_0.5.0_linux_amd64.tar.gz" +url_api = "https://api.github.com/repos/grafana/gcx/releases/assets/484583622" + +[tools."aqua:grafana/gcx"."platforms.linux-x64-musl"] +checksum = "sha256:5c0ce026b0625da09ee976115799cba28e6c84375f802c64f7995c0ba87a83b6" +url = "https://github.com/grafana/gcx/releases/download/v0.5.0/gcx_0.5.0_linux_amd64.tar.gz" +url_api = "https://api.github.com/repos/grafana/gcx/releases/assets/484583622" + +[tools."aqua:grafana/gcx"."platforms.macos-arm64"] +checksum = "sha256:3835b426490dddbf0cd3cd4a96566ebb2b2a45121c3d61c518e8c3ae54d1ac0c" +url = "https://github.com/grafana/gcx/releases/download/v0.5.0/gcx_0.5.0_darwin_arm64.tar.gz" +url_api = "https://api.github.com/repos/grafana/gcx/releases/assets/484583602" + +[tools."aqua:grafana/gcx"."platforms.macos-x64"] +checksum = "sha256:40db287702572bc9e7c5decdd25cd054e8b076008b8f3d543eafa721441da4db" +url = "https://github.com/grafana/gcx/releases/download/v0.5.0/gcx_0.5.0_darwin_amd64.tar.gz" +url_api = "https://api.github.com/repos/grafana/gcx/releases/assets/484583604" + +[tools."aqua:grafana/gcx"."platforms.windows-x64"] +checksum = "sha256:e71bdc867b6d13399d4aad15a667c7bc5c6fbf37a187cb87dafeb61113c48921" +url = "https://github.com/grafana/gcx/releases/download/v0.5.0/gcx_0.5.0_windows_amd64.zip" +url_api = "https://api.github.com/repos/grafana/gcx/releases/assets/484583601" + +[[tools."aqua:grafana/oats"]] +version = "0.8.0" +backend = "aqua:grafana/oats" + +[tools."aqua:grafana/oats"."platforms.linux-arm64"] +checksum = "sha256:82eaf1e836cea916b96cef6745423efd8256ceab64bbabd1fa8f13b3883a1212" +url = "https://github.com/grafana/oats/releases/download/v0.8.0/oats_0.8.0_linux_arm64.tar.gz" +url_api = "https://api.github.com/repos/grafana/oats/releases/assets/487171323" +provenance = "github-attestations" + +[tools."aqua:grafana/oats"."platforms.linux-arm64-musl"] +checksum = "sha256:82eaf1e836cea916b96cef6745423efd8256ceab64bbabd1fa8f13b3883a1212" +url = "https://github.com/grafana/oats/releases/download/v0.8.0/oats_0.8.0_linux_arm64.tar.gz" +url_api = "https://api.github.com/repos/grafana/oats/releases/assets/487171323" +provenance = "github-attestations" + +[tools."aqua:grafana/oats"."platforms.linux-x64"] +checksum = "sha256:ea4368c6d7f62244ce959ba60512f271d46d133b50350077257e2bb81c03a5ca" +url = "https://github.com/grafana/oats/releases/download/v0.8.0/oats_0.8.0_linux_amd64.tar.gz" +url_api = "https://api.github.com/repos/grafana/oats/releases/assets/487171351" +provenance = "github-attestations" + +[tools."aqua:grafana/oats"."platforms.linux-x64-musl"] +checksum = "sha256:ea4368c6d7f62244ce959ba60512f271d46d133b50350077257e2bb81c03a5ca" +url = "https://github.com/grafana/oats/releases/download/v0.8.0/oats_0.8.0_linux_amd64.tar.gz" +url_api = "https://api.github.com/repos/grafana/oats/releases/assets/487171351" +provenance = "github-attestations" + +[tools."aqua:grafana/oats"."platforms.macos-arm64"] +checksum = "sha256:156bb14787a09093de8ad0370c95e8104b771ca0b3ede382541f9837db797f27" +url = "https://github.com/grafana/oats/releases/download/v0.8.0/oats_0.8.0_darwin_arm64.tar.gz" +url_api = "https://api.github.com/repos/grafana/oats/releases/assets/487171322" +provenance = "github-attestations" + +[tools."aqua:grafana/oats"."platforms.macos-x64"] +checksum = "sha256:034bc120d0d8bbf8aff05f61a6b569efec821df19bd25bb602ee77d4a6368235" +url = "https://github.com/grafana/oats/releases/download/v0.8.0/oats_0.8.0_darwin_amd64.tar.gz" +url_api = "https://api.github.com/repos/grafana/oats/releases/assets/487171352" +provenance = "github-attestations" + +[tools."aqua:grafana/oats"."platforms.windows-x64"] +checksum = "sha256:166a5577c66efa9e4d677856ae1780212ee27c081042c8d54db0c996019adbc0" +url = "https://github.com/grafana/oats/releases/download/v0.8.0/oats_0.8.0_windows_amd64.zip" +url_api = "https://api.github.com/repos/grafana/oats/releases/assets/487171324" +provenance = "github-attestations" + [[tools."aqua:jonwiggins/xmloxide"]] version = "v0.4.3" backend = "aqua:jonwiggins/xmloxide" @@ -250,10 +335,6 @@ checksum = "sha256:7ec31e1a6a9983aa2a4942cb66dfd35e8b61e76263460413988438ae14269 url = "https://github.com/editorconfig-checker/editorconfig-checker/releases/download/v3.8.0/ec-windows-amd64.zip" url_api = "https://api.github.com/repos/editorconfig-checker/editorconfig-checker/releases/assets/460248513" -[[tools."go:github.com/grafana/oats"]] -version = "0.7.0" -backend = "go:github.com/grafana/oats" - [[tools.google-java-format]] version = "1.35.0" backend = "aqua:google/google-java-format" diff --git a/mise.toml b/mise.toml index 93e9a3634..dfa2cf142 100644 --- a/mise.toml +++ b/mise.toml @@ -1,5 +1,6 @@ [tools] -"go:github.com/grafana/oats" = "0.7.0" +"aqua:grafana/gcx" = "v0.5.0" +"aqua:grafana/oats" = "0.8.0" hugo = "0.164.0" java = "temurin-25.0.3+9.0.LTS" node = "24.18.0" @@ -93,7 +94,12 @@ run = "flint run --fix" [tasks.acceptance-test] description = "Run OATs acceptance tests" depends = "build" -run = "oats -lgtm-version $LGTM_VERSION -timeout 5m examples/" +run = """ +oats \ + --config oats-config.yaml \ + --no-cache \ + --timeout=5m +""" [tasks.javadoc] description = "Generate Javadoc" diff --git a/oats-config.yaml b/oats-config.yaml new file mode 100644 index 000000000..d23490ffb --- /dev/null +++ b/oats-config.yaml @@ -0,0 +1,6 @@ +meta: + version: 3 + +cases: + - examples/example-exporter-opentelemetry/oats-tests/http/oats-case.yaml + - examples/example-exporter-opentelemetry/oats-tests/agent/oats-case.yaml From e885c3127351061342cf992e0e2c809ec1196351 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 23 Jul 2026 15:43:14 +0200 Subject: [PATCH 2/2] restore pin Signed-off-by: Gregor Zeitlinger --- mise.toml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mise.toml b/mise.toml index dfa2cf142..a9dbac2bc 100644 --- a/mise.toml +++ b/mise.toml @@ -94,12 +94,7 @@ run = "flint run --fix" [tasks.acceptance-test] description = "Run OATs acceptance tests" depends = "build" -run = """ -oats \ - --config oats-config.yaml \ - --no-cache \ - --timeout=5m -""" +run = "oats --no-cache --lgtm-version $LGTM_VERSION --timeout 5m ." [tasks.javadoc] description = "Generate Javadoc"