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

Add a test for the doc-generator #10

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

avlitman
Copy link
Collaborator

Add a test to verify the doc generator adding metrics and recording rules.

Copy link
Owner

@machadovilaca machadovilaca left a comment

Choose a reason for hiding this comment

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

can you also add a test for the metrics building with a custom template? you can create a simple template with some unique strings, and check they appear in the output

pkg/docs/docs_suite_test.go Outdated Show resolved Hide resolved
pkg/docs/metrics_test.go Outdated Show resolved Hide resolved
pkg/docs/metrics_test.go Outdated Show resolved Hide resolved
pkg/docs/metrics_test.go Outdated Show resolved Hide resolved
pkg/docs/metrics_test.go Outdated Show resolved Hide resolved
pkg/docs/metrics_test.go Outdated Show resolved Hide resolved
@avlitman
Copy link
Collaborator Author

@machadovilaca Fixed your comment, WDYT?

Signed-off-by: avlitman <alitman@redhat.com>
Comment on lines +87 to +97
It("Checks that the metrics doc is sorted by metrics and recording rules name", func() {
templateDocMetrics := BuildMetricsDocsWithCustomTemplate(metrics, recordingRules, tpl)
indexOfA := strings.Index(templateDocMetrics, "AExampleRecordingRule")
indexOfB := strings.Index(templateDocMetrics, "BExampleGauge")
indexOfC := strings.Index(templateDocMetrics, "CExampleRecordingRule")
indexOfD := strings.Index(templateDocMetrics, "DExampleCounterVec")

Expect(indexOfA).To(BeNumerically("<", indexOfB))
Expect(indexOfB).To(BeNumerically("<", indexOfC))
Expect(indexOfC).To(BeNumerically("<", indexOfD))
})
Copy link
Owner

Choose a reason for hiding this comment

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

👌

@machadovilaca machadovilaca merged commit 0820c30 into machadovilaca:main Apr 11, 2024
1 check passed
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.

None yet

2 participants