From 7b0fcc79a5e6796063ecb458eb333b52f20d10b2 Mon Sep 17 00:00:00 2001 From: Lukasz Mierzwa Date: Fri, 17 Jan 2025 17:40:54 +0000 Subject: [PATCH] Fix tests --- cmd/pint/tests/0206_parser_schema_err.txt | 2 +- internal/config/config_test.go | 8 ++++++++ internal/config/parser.go | 2 +- internal/config/parser_test.go | 8 +++++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/cmd/pint/tests/0206_parser_schema_err.txt b/cmd/pint/tests/0206_parser_schema_err.txt index bef42643..22b5c6fd 100644 --- a/cmd/pint/tests/0206_parser_schema_err.txt +++ b/cmd/pint/tests/0206_parser_schema_err.txt @@ -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 diff --git a/internal/config/config_test.go b/internal/config/config_test.go index d1ef6510..b8495202 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -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 { diff --git a/internal/config/parser.go b/internal/config/parser.go index aa4cad91..8c426c0e 100644 --- a/internal/config/parser.go +++ b/internal/config/parser.go @@ -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 { diff --git a/internal/config/parser_test.go b/internal/config/parser_test.go index 785e3d9e..5417d60a 100644 --- a/internal/config/parser_test.go +++ b/internal/config/parser_test.go @@ -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"), }, }