Skip to content

Commit

Permalink
Merge pull request #1081 from cloudflare/cli
Browse files Browse the repository at this point in the history
Add enable flag to cli commands
  • Loading branch information
prymitive authored Aug 23, 2024
2 parents 074b42b + e6354f4 commit ef91e8b
Show file tree
Hide file tree
Showing 49 changed files with 469 additions and 173 deletions.
2 changes: 1 addition & 1 deletion cmd/pint/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ rule {
require.NoError(b, os.WriteFile(tmp+"/.pint.hcl", content, 0o644))

ctx := context.Background()
cfg, err := config.Load(tmp+"/.pint.hcl", false)
cfg, _, err := config.Load(tmp+"/.pint.hcl", false)
require.NoError(b, err)

gen := config.NewPrometheusGenerator(cfg, prometheus.NewRegistry())
Expand Down
2 changes: 1 addition & 1 deletion cmd/pint/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func actionConfig(c *cli.Context) (err error) {
return fmt.Errorf("failed to set log level: %w", err)
}

cfg, err := config.Load(c.Path(configFlag), c.IsSet(configFlag))
cfg, _, err := config.Load(c.Path(configFlag), c.IsSet(configFlag))
if err != nil {
return fmt.Errorf("failed to load config file %q: %w", c.Path(configFlag), err)
}
Expand Down
20 changes: 19 additions & 1 deletion cmd/pint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
const (
configFlag = "config"
logLevelFlag = "log-level"
enabledFlag = "enabled"
disabledFlag = "disabled"
offlineFlag = "offline"
noColorFlag = "no-color"
Expand Down Expand Up @@ -59,6 +60,12 @@ func newApp() *cli.App {
Value: cli.NewStringSlice(),
Usage: "List of checks to disable (example: promql/cost).",
},
&cli.StringSliceFlag{
Name: enabledFlag,
Aliases: []string{"e"},
Value: cli.NewStringSlice(),
Usage: "Only enable these checks (example: promql/cost).",
},
&cli.BoolFlag{
Name: offlineFlag,
Aliases: []string{"o"},
Expand Down Expand Up @@ -100,11 +107,22 @@ func actionSetup(c *cli.Context) (meta actionMeta, err error) {
return meta, fmt.Errorf("--%s flag must be > 0", workersFlag)
}

meta.cfg, err = config.Load(c.Path(configFlag), c.IsSet(configFlag))
var fromFile bool
meta.cfg, fromFile, err = config.Load(c.Path(configFlag), c.IsSet(configFlag))
if err != nil {
return meta, fmt.Errorf("failed to load config file %q: %w", c.Path(configFlag), err)
}
if fromFile {
slog.Debug("Adding pint config to the parser exclude list", slog.String("path", c.Path(configFlag)))
meta.cfg.Parser.Exclude = append(meta.cfg.Parser.Exclude, c.Path(configFlag))
}

meta.cfg.SetDisabledChecks(c.StringSlice(disabledFlag))
enabled := c.StringSlice(enabledFlag)
if len(enabled) > 0 {
meta.cfg.Checks.Enabled = enabled
}

if c.Bool(offlineFlag) {
meta.isOffline = true
meta.cfg.DisableOnlineChecks()
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0018_match_alerting.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=2
level=DEBUG msg="Glob finder completed" count=2
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0019_match_recording.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=2
level=DEBUG msg="Glob finder completed" count=2
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0020_ignore_kind.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=2
level=DEBUG msg="Glob finder completed" count=2
Expand Down
3 changes: 2 additions & 1 deletion cmd/pint/tests/0028_ci_git_error.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ cmp stderr ../stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=DEBUG msg="Running git command" args=["rev-parse","--abbrev-ref","HEAD"]
level=DEBUG msg="Got branch information" base=notmain current=v2
level=INFO msg="Finding all rules to check on current git branch" base=notmain
level=DEBUG msg="Excluding git directory from glob results" path=.git glob=*
level=DEBUG msg="File parsed" path=.pint.hcl rules=0
level=DEBUG msg="File path is in the exclude list" path=.pint.hcl exclude=["^.pint.hcl$"]
level=DEBUG msg="File parsed" path=rules.yml rules=2
level=DEBUG msg="Glob finder completed" count=2
level=DEBUG msg="Running git command" args=["log","--reverse","--no-merges","--first-parent","--format=%H","--name-status","notmain..HEAD"]
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0037_disable_checks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=3
level=DEBUG msg="Glob finder completed" count=3
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0039_prom_selected_path.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=3
level=DEBUG msg="Glob finder completed" count=3
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0040_rule_match_label.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/rules.yml rules=4
level=DEBUG msg="Glob finder completed" count=4
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0052_match_multiple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=2
level=DEBUG msg="Glob finder completed" count=2
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0053_ignore_multiple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=2
level=DEBUG msg="Glob finder completed" count=2
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0095_rulefmt_symlink.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/relaxed/1.yml rules=1
level=DEBUG msg="File parsed" path=rules/strict/symlink.yml rules=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0099_symlink_outside_glob.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules/relaxed"]
level=DEBUG msg="File parsed" path=rules/relaxed/1.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0103_file_disable.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0111_snooze.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0112_expired_snooze.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0115_file_disable_tag.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0116_file_snooze.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="Check snoozed by comment" check=promql/aggregate(job:true) match=promql/aggregate(job:true) until="2099-11-28T10:24:18Z"
level=DEBUG msg="Check snoozed by comment" check=alerts/for match=alerts/for until="2099-11-28T10:24:18Z"
Expand Down
3 changes: 2 additions & 1 deletion cmd/pint/tests/0134_ci_base_branch_flag_path.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ cmp stderr ../stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=DEBUG msg="Running git command" args=["rev-parse","--abbrev-ref","HEAD"]
level=DEBUG msg="Got branch information" base=origin/main current=v2
level=INFO msg="Finding all rules to check on current git branch" base=origin/main
level=DEBUG msg="Excluding git directory from glob results" path=.git glob=*
level=DEBUG msg="File parsed" path=.pint.hcl rules=0
level=DEBUG msg="File path is in the exclude list" path=.pint.hcl exclude=["^.pint.hcl$"]
level=DEBUG msg="File parsed" path=rules.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
level=DEBUG msg="Running git command" args=["log","--reverse","--no-merges","--first-parent","--format=%H","--name-status","origin/main..HEAD"]
Expand Down
3 changes: 2 additions & 1 deletion cmd/pint/tests/0135_ci_base_branch_config_path.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ cmp stderr ../stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=DEBUG msg="Running git command" args=["rev-parse","--abbrev-ref","HEAD"]
level=DEBUG msg="Got branch information" base=origin/main current=v2
level=INFO msg="Finding all rules to check on current git branch" base=origin/main
level=DEBUG msg="Excluding git directory from glob results" path=.git glob=*
level=DEBUG msg="File parsed" path=.pint.hcl rules=0
level=DEBUG msg="File path is in the exclude list" path=.pint.hcl exclude=["^.pint.hcl$"]
level=DEBUG msg="File parsed" path=rules.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
level=DEBUG msg="Running git command" args=["log","--reverse","--no-merges","--first-parent","--format=%H","--name-status","origin/main..HEAD"]
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0144_discovery_filepath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0145_discovery_filepath_dup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0147_discovery_filepath_error.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0148_discovery_prom_zero.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0149_discovery_prom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0150_discovery_prom_dup_tags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0151_discovery_prom_error.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0152_discovery_prom_dup_uptime.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0155_discovery_prom_dup_include.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0156_discovery_prom_dup_exclude.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="Glob finder completed" count=1
Expand Down
1 change: 0 additions & 1 deletion cmd/pint/tests/0167_rule_duplicate_symlink.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ cmp stderr ../stderrV1.txt
-- stderrV1.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check on current git branch" base=main
level=WARN msg="Failed to parse file content" err="error at line 1: top level field must be a groups key, got string" path=.pint.hcl lines=1-20
level=INFO msg="Configured new Prometheus server" name=prom1 uris=1 uptime=up tags=[] include=["^rules.yml$"] exclude=[]
level=INFO msg="Configured new Prometheus server" name=prom2 uris=1 uptime=up tags=[] include=["^symlink.yml$"] exclude=[]
-- stderrV2.txt --
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0169_watch_rule_files_noprom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Configured new Prometheus server" name=foo uris=1 uptime=up tags=[] include=[] exclude=[]
level=DEBUG msg="Starting query workers" name=foo uri=http://localhost:7169 workers=16
level=ERROR msg="Fatal error" err="no Prometheus named \"prom\" configured in pint"
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0170_watch_rule_files_error.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Configured new Prometheus server" name=prom uris=1 uptime=up tags=[] include=[] exclude=[]
level=DEBUG msg="Starting query workers" name=prom uri=http://localhost:7170 workers=16
level=DEBUG msg="Starting rule_fules watch" name=prom
Expand Down
1 change: 0 additions & 1 deletion cmd/pint/tests/0173_rule_duplicate_move.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ cmp stderr ../stderr.txt
-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check on current git branch" base=main
level=WARN msg="Failed to parse file content" err="error at line 1: top level field must be a groups key, got string" path=.pint.hcl lines=1-24
level=INFO msg="Configured new Prometheus server" name=prom1 uris=1 uptime=up tags=[] include=["^rules/alert.*$"] exclude=[]
level=INFO msg="Configured new Prometheus server" name=prom2a uris=1 uptime=up tags=[] include=["^rules/record.*$"] exclude=[]
level=INFO msg="Configured new Prometheus server" name=prom2b uris=1 uptime=up tags=[] include=["^rules/record.*$"] exclude=[]
Expand Down
1 change: 1 addition & 0 deletions cmd/pint/tests/0178_parser_include.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File path is in the include list" path=rules/0001.yml include=["^rules/0001.yml$"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
Expand Down
3 changes: 2 additions & 1 deletion cmd/pint/tests/0179_parser_exclude.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="File path is in the exclude list" path=rules/0002.yml exclude=["^rules/0002.yml$"]
level=DEBUG msg="File path is in the exclude list" path=rules/0002.yml exclude=["^rules/0002.yml$","^.pint.hcl$"]
level=DEBUG msg="Glob finder completed" count=1
level=DEBUG msg="Generated all Prometheus servers" count=0
level=DEBUG msg="Found recording rule" path=rules/0001.yml record=ok lines=1-2
Expand Down
3 changes: 2 additions & 1 deletion cmd/pint/tests/0180_parser_exclude_md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=DEBUG msg="Adding pint config to the parser exclude list" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=DEBUG msg="File parsed" path=rules/0001.yml rules=1
level=DEBUG msg="File path is in the exclude list" path=rules/README.md exclude=["^.*.md$"]
level=DEBUG msg="File path is in the exclude list" path=rules/README.md exclude=["^.*.md$","^.pint.hcl$"]
level=DEBUG msg="Glob finder completed" count=1
level=DEBUG msg="Generated all Prometheus servers" count=0
level=DEBUG msg="Found recording rule" path=rules/0001.yml record=ok lines=1-2
Expand Down
Loading

0 comments on commit ef91e8b

Please sign in to comment.