Skip to content

Commit

Permalink
test: deprecated config 2_4 with create.force to false
Browse files Browse the repository at this point in the history
in this case the check must fail because it does not fulfill the
requirements.

Signed-off-by: Mathieu Tortuyaux <[email protected]>
  • Loading branch information
tormath1 committed Nov 17, 2021
1 parent 520bfdb commit 058ae48
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 058ae48

Please sign in to comment.