Skip to content

Commit

Permalink
buildconfig: disable tests for undecoded keys for now
Browse files Browse the repository at this point in the history
This commit partially reverts PT#549 to unblock filesystem
customizations in bib.

This is a short term fix and we should revert and do something
smarter like osbuild/images#951 or see
if we can do better in the toml unmarshaling. But to unblock
toml customizations this is a (IMHO) reasonable first step.

Closes: osbuild#655
  • Loading branch information
mvo5 committed Sep 24, 2024
1 parent 2aaa251 commit 1c728d7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
6 changes: 1 addition & 5 deletions bib/internal/buildconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,11 @@ func decodeTomlBuildConfig(r io.Reader, what string) (*BuildConfig, error) {
dec := toml.NewDecoder(r)

var conf BuildConfig
metadata, err := dec.Decode(&conf)
_, err := dec.Decode(&conf)
if err != nil {
return nil, fmt.Errorf("cannot decode %q: %w", what, err)
}

if len(metadata.Undecoded()) > 0 {
return nil, fmt.Errorf("cannot decode %q: unknown keys found: %v", what, metadata.Undecoded())
}

return &conf, nil
}

Expand Down
10 changes: 0 additions & 10 deletions bib/internal/buildconfig/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,6 @@ func TestReadLegacyJSONConfig(t *testing.T) {
assert.Equal(t, expectedBuildConfig, cfg)
}

func TestTomlUnknownKeysError(t *testing.T) {
fakeUserCnfPath := makeFakeConfig(t, "config.toml", `
[[birds]]
name = "toucan"
`)
_, err := buildconfig.ReadWithFallback(fakeUserCnfPath)

assert.ErrorContains(t, err, "unknown keys found: [birds birds.name]")
}

func TestJsonUnknownKeysError(t *testing.T) {
fakeUserCnfPath := makeFakeConfig(t, "config.json", `
{
Expand Down

0 comments on commit 1c728d7

Please sign in to comment.