-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add product test for Loki connector #27201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or 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 comment was marked as spam.
This comment was marked as spam.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- The TestLoki integration test may be flaky if logs aren’t ingested immediately; consider adding a retry loop or wait condition before querying for results.
- To avoid interference between test runs, use a unique label or clear existing logs in Loki so that concurrent tests don’t pick up stale entries.
- Instead of hardcoding the Grafana Loki Docker image version in EnvMultinodeLoki, consider centralizing the version in a configuration constant for easier upgrades.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The TestLoki integration test may be flaky if logs aren’t ingested immediately; consider adding a retry loop or wait condition before querying for results.
- To avoid interference between test runs, use a unique label or clear existing logs in Loki so that concurrent tests don’t pick up stale entries.
- Instead of hardcoding the Grafana Loki Docker image version in EnvMultinodeLoki, consider centralizing the version in a configuration constant for easier upgrades.
## Individual Comments
### Comment 1
<location> `testing/trino-product-tests/src/main/java/io/trino/tests/product/loki/TestLoki.java:51-56` </location>
<code_context>
+ client.pushLogLine("line 3", end.minus(Duration.ofMinutes(1)), ImmutableMap.of("test", "logs_query"));
+ client.flush();
+
+ assertThat(onTrino().executeQuery("SELECT value FROM TABLE(loki.system.query_range(" +
+ "'{test=\"logs_query\"}'," +
+ "TIMESTAMP '" + TIMESTAMP_FORMATTER.format(start) + "'," +
+ "TIMESTAMP '" + TIMESTAMP_FORMATTER.format(end) + "'))" +
+ "LIMIT 1"))
+ .containsOnly(row("line 1"));
+ }
+}
</code_context>
<issue_to_address>
**suggestion (testing):** Suggestion to add assertions for all returned log lines, not just the first.
Adding assertions for all expected log lines will improve test coverage and ensure the query_range function returns the complete and correctly ordered results.
```suggestion
assertThat(onTrino().executeQuery("SELECT value FROM TABLE(loki.system.query_range(" +
"'{test=\"logs_query\"}'," +
"TIMESTAMP '" + TIMESTAMP_FORMATTER.format(start) + "'," +
"TIMESTAMP '" + TIMESTAMP_FORMATTER.format(end) + "'))"))
.containsExactly(
row("line 1"),
row("line 2"),
row("line 3")
);
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
1061d29 to
12cbfa6
Compare
ebyhr
commented
Nov 4, 2025
| private static final DateTimeFormatter TIMESTAMP_FORMATTER = DateTimeFormatter.ofPattern("uuuu-MM-dd HH:mm:ss.SSS'Z'").withZone(UTC); | ||
|
|
||
| @Test(groups = {LOKI, PROFILE_SPECIFIC_TESTS}) | ||
| public void testQueryRange() |
Member
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests | 2025-11-04 06:49:08 INFO: SUCCESS / io.trino.tests.product.loki.TestLoki.testQueryRange (Groups: profile_specific_tests, loki) took 1.4 seconds
tests | 2025-11-04 06:49:08 INFO:
tests | 2025-11-04 06:49:08 INFO: Completed 2 tests
tests | 2025-11-04 06:49:08 INFO: 2 SUCCEEDED / 0 FAILED / 0 SKIPPED
tests | 2025-11-04 06:49:08 INFO: Tests execution took 4.7 seconds
tests | 2025-11-04 06:49:08 INFO: ManageTestResources.onFinish: running checks
tests |
tests | ===============================================
tests | tempto-tests
tests | Total tests run: 2, Failures: 0, Skips: 0
tests | ===============================================
wendigo
approved these changes
Nov 4, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The 1st commit comes from #27199
Fixes #26500, Fixes #27180
Release notes