From f2ecdecc5f303fc88f10db96d091ca93738a3567 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 24 Sep 2024 15:58:14 +0200 Subject: [PATCH] buildconfig: disable tests for undecoded keys for now 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 https://github.com/osbuild/images/pull/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: https://github.com/osbuild/bootc-image-builder/issues/655 --- bib/internal/buildconfig/config.go | 6 +----- bib/internal/buildconfig/config_test.go | 10 ---------- test/test_manifest.py | 2 +- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/bib/internal/buildconfig/config.go b/bib/internal/buildconfig/config.go index 9a4482bd..48a6a2af 100644 --- a/bib/internal/buildconfig/config.go +++ b/bib/internal/buildconfig/config.go @@ -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 } diff --git a/bib/internal/buildconfig/config_test.go b/bib/internal/buildconfig/config_test.go index af2bf2df..7b06881a 100644 --- a/bib/internal/buildconfig/config_test.go +++ b/bib/internal/buildconfig/config_test.go @@ -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", ` { diff --git a/test/test_manifest.py b/test/test_manifest.py index 57fd17fd..1978d614 100644 --- a/test/test_manifest.py +++ b/test/test_manifest.py @@ -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, }