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 25, 2024
1 parent 2aaa251 commit 4701613
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 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
2 changes: 1 addition & 1 deletion test/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def test_manifest_fs_customizations_smoke_toml(tmp_path, build_container):
rootfs = "xfs"

expected_fs_customizations = {
"/": 10 * 1024 * 1024 * 1024,
"/": 10 * 1024 * 1024 * 1024,
"/var/data": 20 * 1024 * 1024 * 1024,
}

Expand Down

0 comments on commit 4701613

Please sign in to comment.