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

Promtool: Add feature flags to unit tests #8958

Merged
merged 3 commits into from
Jun 30, 2021

Conversation

LeviHarrison
Copy link
Member

This PR adds feature flag support to Promtool unit tests.

(Partially) Fixes #8607 - I've left out feature flags for rule linting because they're only parsed, not executed, which is where expressions are checked for disabled features. Discussions are still ongoing though.

Signed-off-by: Levi Harrison <git@leviharrison.dev>
Signed-off-by: Levi Harrison <git@leviharrison.dev>
Copy link
Member

@roidelapluie roidelapluie left a comment

Choose a reason for hiding this comment

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

Thanks! I have left a few comments.

@@ -39,6 +39,7 @@ import (
"github.com/prometheus/common/model"
"github.com/prometheus/common/version"
"github.com/prometheus/exporter-toolkit/web"
"github.com/prometheus/prometheus/promql"
Copy link
Member

Choose a reason for hiding this comment

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

This import is misplaced.

@@ -162,6 +163,8 @@ func main() {
"A list of one or more files containing recording rules to be backfilled. All recording rules listed in the files will be backfilled. Alerting rules are not evaluated.",
).Required().ExistingFiles()

featureList := app.Flag("enable-feature", "Comma separated feature names to enable (only PromQL related). Valid options: promql-at-modifier, promql-negative-offset. See https://prometheus.io/docs/prometheus/latest/disabled_features/ for more details.").Default("").Strings()
Copy link
Member

Choose a reason for hiding this comment

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

How could we keep that in sync with cmd/prometheus? Maybe we should just link to the web page?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, that sounds good

cmd/promtool/main.go Show resolved Hide resolved
cmd/promtool/main.go Outdated Show resolved Hide resolved
Signed-off-by: Levi Harrison <git@leviharrison.dev>
@dgl dgl merged commit 90976e7 into prometheus:main Jun 30, 2021
@LeviHarrison LeviHarrison deleted the unittest-feature-flags branch June 30, 2021 22:30
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.

Add feature flags to promtool
3 participants