Skip to content
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

integration: properly parse output metrics and assert more things about them #44

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

nadiamoe
Copy link
Member

@nadiamoe nadiamoe commented Jan 15, 2025

This PR improves the existing integration test making it more exhaustive.

Previously, the extension output was parsed as text and it was checked as such, which only allowed for few assertions to be made without very complicated code.

This PR imports the Prometheus parser and data models, and parses the output with them. This unblocks more exhaustive assertions, which I also add on this PR.

The main motivation for this PR is to get good coverage to assert that the big refactor in #34 is still conformant with the previous behavior.

@nadiamoe nadiamoe force-pushed the integration-prometheus branch 2 times, most recently from 5bb2694 to 70d4eec Compare January 15, 2025 13:20
@nadiamoe nadiamoe changed the title integration: improve integration test by parsing output metrics and asserting properties on them integration: properly parse output metrics and asserting properties on them Jan 15, 2025
@nadiamoe nadiamoe force-pushed the integration-prometheus branch from 70d4eec to 80516fc Compare January 15, 2025 13:29
@nadiamoe nadiamoe changed the title integration: properly parse output metrics and asserting properties on them integration: properly parse output metrics and assert more things about them Jan 15, 2025
@nadiamoe nadiamoe force-pushed the integration-prometheus branch from f36271d to 7b04031 Compare January 15, 2025 14:10
@nadiamoe nadiamoe marked this pull request as ready for review January 15, 2025 14:13
@nadiamoe nadiamoe requested a review from a team as a code owner January 15, 2025 14:13
Comment on lines -22 to -34
t.Run("metrics", func(t *testing.T) {
for _, tc := range []struct {
name string
script []byte
}{
{
name: "singleRequest",
script: scriptSingleRequest,
},
} {
tc := tc

t.Run(tc.name, func(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This used to create two subtests, one for metrics and then one for each script we run. As it turns out, we only test for metrics and we only run that script, so I removed these two subtests entirely and decreased indentation a bunch. Git does not do a good job displaying this indentation change.

Feel free to switch to the single commit view for a less noisy diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant