Skip to content

Commit

Permalink
manifest: check len(SudoNopasswd) in test instead of true/false
Browse files Browse the repository at this point in the history
Check the input instead of passing true/false for every test.
  • Loading branch information
achilleas-k authored and thozza committed Apr 26, 2024
1 parent d639950 commit f20af02
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/manifest/anaconda_installer_iso_tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func TestAnacondaISOTreeSerializeWithOS(t *testing.T) {
pipeline.serializeEnd()
assert.NoError(t, checkISOTreeStages(sp.Stages, append(payloadStages, "org.osbuild.isolinux", "org.osbuild.kickstart"),
variantStages))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, false, ""))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, len(pipeline.Kickstart.SudoNopasswd) > 0, ""))
})

t.Run("unattended+sudo", func(t *testing.T) {
Expand All @@ -347,7 +347,7 @@ func TestAnacondaISOTreeSerializeWithOS(t *testing.T) {
pipeline.serializeEnd()
assert.NoError(t, checkISOTreeStages(sp.Stages, append(payloadStages, "org.osbuild.isolinux", "org.osbuild.kickstart"),
variantStages))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, true, ""))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, len(pipeline.Kickstart.SudoNopasswd) > 0, ""))
})

t.Run("user-kickstart-without-sudo-bits", func(t *testing.T) {
Expand All @@ -367,7 +367,7 @@ func TestAnacondaISOTreeSerializeWithOS(t *testing.T) {
pipeline.serializeEnd()
assert.NoError(t, checkISOTreeStages(sp.Stages, append(payloadStages, "org.osbuild.isolinux", "org.osbuild.kickstart"),
variantStages))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, false, userks))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, len(pipeline.Kickstart.SudoNopasswd) > 0, userks))
})

t.Run("user-kickstart-with-sudo-bits", func(t *testing.T) {
Expand All @@ -388,7 +388,7 @@ func TestAnacondaISOTreeSerializeWithOS(t *testing.T) {
pipeline.serializeEnd()
assert.NoError(t, checkISOTreeStages(sp.Stages, append(payloadStages, "org.osbuild.isolinux", "org.osbuild.kickstart"),
variantStages))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, true, userks))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, len(pipeline.Kickstart.SudoNopasswd) > 0, userks))
})

}
Expand Down Expand Up @@ -441,7 +441,7 @@ func TestAnacondaISOTreeSerializeWithOSTree(t *testing.T) {
sp := pipeline.serialize()
pipeline.serializeEnd()
assert.NoError(t, checkISOTreeStages(sp.Stages, append(payloadStages, "org.osbuild.isolinux"), variantStages))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, false, ""))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, len(pipeline.Kickstart.SudoNopasswd) > 0, ""))
})

t.Run("unattended+sudo", func(t *testing.T) {
Expand All @@ -456,7 +456,7 @@ func TestAnacondaISOTreeSerializeWithOSTree(t *testing.T) {
sp := pipeline.serialize()
pipeline.serializeEnd()
assert.NoError(t, checkISOTreeStages(sp.Stages, append(payloadStages, "org.osbuild.isolinux"), variantStages))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, true, ""))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, len(pipeline.Kickstart.SudoNopasswd) > 0, ""))
})

t.Run("user-kickstart-without-sudo-bits", func(t *testing.T) {
Expand All @@ -474,7 +474,7 @@ func TestAnacondaISOTreeSerializeWithOSTree(t *testing.T) {
sp := pipeline.serialize()
pipeline.serializeEnd()
assert.NoError(t, checkISOTreeStages(sp.Stages, append(payloadStages, "org.osbuild.isolinux"), variantStages))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, false, userks))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, len(pipeline.Kickstart.SudoNopasswd) > 0, userks))
})

t.Run("user-kickstart-with-sudo-bits", func(t *testing.T) {
Expand All @@ -493,7 +493,7 @@ func TestAnacondaISOTreeSerializeWithOSTree(t *testing.T) {
sp := pipeline.serialize()
pipeline.serializeEnd()
assert.NoError(t, checkISOTreeStages(sp.Stages, append(payloadStages, "org.osbuild.isolinux"), variantStages))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, true, userks))
assert.NoError(t, checkKickstartUnattendedOptions(sp.Stages, len(pipeline.Kickstart.SudoNopasswd) > 0, userks))
})
}

Expand Down

0 comments on commit f20af02

Please sign in to comment.