From 058ae48b312c9d59a4edce523974615cfae5014f Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Wed, 17 Nov 2021 10:50:02 +0100 Subject: [PATCH] test: deprecated config 2_4 with create.force to false in this case the check must fail because it does not fulfill the requirements. Signed-off-by: Mathieu Tortuyaux --- translate_test.go | 71 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/translate_test.go b/translate_test.go index e36a597..2808785 100644 --- a/translate_test.go +++ b/translate_test.go @@ -553,6 +553,72 @@ var ( }, } + badDeprecatedConfig2_4 = types2_4.Config{ + Ignition: types2_4.Ignition{ + Version: "2.4.0", + Config: types2_4.IgnitionConfig{ + Append: []types2_4.ConfigReference{ + { + Source: "https://example.com", + Verification: types2_4.Verification{ + Hash: &aSha512Hash, + }, + }, + }, + Replace: &types2_4.ConfigReference{ + Source: "https://example.com", + Verification: types2_4.Verification{ + Hash: &aSha512Hash, + }, + }, + }, + Timeouts: types2_4.Timeouts{ + HTTPResponseHeaders: util.IntP(5), + HTTPTotal: util.IntP(10), + }, + Security: types2_4.Security{ + TLS: types2_4.TLS{ + CertificateAuthorities: []types2_4.CaReference{ + { + Source: "https://example.com", + Verification: types2_4.Verification{ + Hash: &aSha512Hash, + }, + }, + }, + }, + }, + Proxy: types2_4.Proxy{ + HTTPProxy: "https://proxy.example.net/", + HTTPSProxy: "https://secure.proxy.example.net/", + NoProxy: []types2_4.NoProxyItem{ + "www.example.net", + "www.example2.net", + }, + }, + }, + Storage: types2_4.Storage{ + Filesystems: []types2_4.Filesystem{ + { + Name: "/var", + Mount: &types2_4.Mount{ + Device: "/dev/disk/by-partlabel/var", + Format: "xfs", + Label: util.StrP("var"), + UUID: &aUUID, + Create: &types2_4.Create{ + Force: false, + Options: []types2_4.CreateOption{ + "--label=var", + types2_4.CreateOption(fmt.Sprintf("--uuid=%s", aUUID)), + }, + }, + }, + }, + }, + }, + } + exhaustiveConfig2_4 = types2_4.Config{ Ignition: types2_4.Ignition{ Version: "2.4.0", @@ -2431,6 +2497,11 @@ func TestCheck2_4(t *testing.T) { exhaustiveConfig2_4, nil, }, + { + // use `mount.create` with `mount.create.force` set to false. + badDeprecatedConfig2_4, + exhaustiveMap, + }, } for i, e := range goodConfigs { if err := v24tov31.Check2_4(e.cfg, e.fsMap); err != nil {