Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Jan 17, 2025
1 parent bb1b273 commit 7b0fcc7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/pint/tests/0206_parser_schema_err.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Loading configuration file" path=.pint.hcl
level=ERROR msg="Fatal error" err="failed to load config file \".pint.hcl\": unsupported parser scheme: bogus"
level=ERROR msg="Fatal error" err="failed to load config file \".pint.hcl\": unsupported parser schema: bogus"
-- rules/1.yml --
groups:
- name: foo
Expand Down
8 changes: 8 additions & 0 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2343,6 +2343,14 @@ func TestConfigErrors(t *testing.T) {
config: `parser {include = [".+", ".+++"]}`,
err: "error parsing regexp: invalid nested repetition operator: `++`",
},
{
config: `parser {schema = "foo"}`,
err: "unsupported parser schema: foo",
},
{
config: `parser {names = "foo"}`,
err: "unsupported parser names: foo",
},
{
config: `repository {
bitbucket {
Expand Down
2 changes: 1 addition & 1 deletion internal/config/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (p Parser) validate() error {
case SchemaPrometheus:
case SchemaThanos:
default:
return fmt.Errorf("unsupported parser scheme: %s", s)
return fmt.Errorf("unsupported parser schema: %s", s)
}

switch n := p.getNames(); n {
Expand Down
8 changes: 7 additions & 1 deletion internal/config/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ func TestParserSettings(t *testing.T) {
conf: Parser{
Schema: "xxx",
},
err: errors.New("unsupported parser scheme: xxx"),
err: errors.New("unsupported parser schema: xxx"),
},
{
conf: Parser{
Names: "xxx",
},
err: errors.New("unsupported parser names: xxx"),
},
}

Expand Down

0 comments on commit 7b0fcc7

Please sign in to comment.