blueprint: test kernel customization
Edit GetPackages test to expect automatic kernel inclusion. New test for all combinations of adding a kernel to customizations and package list.
This commit is contained in:
parent
b861042032
commit
d0923af70d
1 changed files with 75 additions and 1 deletions
|
|
@ -91,5 +91,79 @@ func TestGetPackages(t *testing.T) {
|
|||
{Name: "anaconda-tools"}},
|
||||
}
|
||||
Received_packages := bp.GetPackages()
|
||||
assert.ElementsMatch(t, []string{"tmux-1.2", "openssh-server", "@anaconda-tools"}, Received_packages)
|
||||
assert.ElementsMatch(t, []string{"tmux-1.2", "openssh-server", "@anaconda-tools", "kernel"}, Received_packages)
|
||||
}
|
||||
|
||||
func TestKernelNameCustomization(t *testing.T) {
|
||||
kernels := []string{"kernel", "kernel-debug", "kernel-rt"}
|
||||
|
||||
for _, k := range kernels {
|
||||
// kernel in customizations
|
||||
bp := Blueprint{
|
||||
Name: "kernel-test",
|
||||
Description: "Testing GetPackages function with custom Kernel",
|
||||
Version: "0.0.1",
|
||||
Packages: []Package{
|
||||
{Name: "tmux", Version: "1.2"}},
|
||||
Modules: []Package{
|
||||
{Name: "openssh-server", Version: "*"}},
|
||||
Groups: []Group{
|
||||
{Name: "anaconda-tools"}},
|
||||
Customizations: &Customizations{
|
||||
Kernel: &KernelCustomization{
|
||||
Name: k,
|
||||
},
|
||||
},
|
||||
}
|
||||
Received_packages := bp.GetPackages()
|
||||
assert.ElementsMatch(t, []string{"tmux-1.2", "openssh-server", "@anaconda-tools", k}, Received_packages)
|
||||
}
|
||||
|
||||
for _, k := range kernels {
|
||||
// kernel in packages
|
||||
bp := Blueprint{
|
||||
Name: "kernel-test",
|
||||
Description: "Testing GetPackages function with custom Kernel",
|
||||
Version: "0.0.1",
|
||||
Packages: []Package{
|
||||
{Name: "tmux", Version: "1.2"},
|
||||
{Name: k},
|
||||
},
|
||||
Modules: []Package{
|
||||
{Name: "openssh-server", Version: "*"}},
|
||||
Groups: []Group{
|
||||
{Name: "anaconda-tools"}},
|
||||
}
|
||||
Received_packages := bp.GetPackages()
|
||||
|
||||
// adds default kernel as well
|
||||
assert.ElementsMatch(t, []string{"tmux-1.2", k, "openssh-server", "@anaconda-tools", "kernel"}, Received_packages)
|
||||
}
|
||||
|
||||
for _, bk := range kernels {
|
||||
for _, ck := range kernels {
|
||||
// all combos of both kernels
|
||||
bp := Blueprint{
|
||||
Name: "kernel-test",
|
||||
Description: "Testing GetPackages function with custom Kernel",
|
||||
Version: "0.0.1",
|
||||
Packages: []Package{
|
||||
{Name: "tmux", Version: "1.2"},
|
||||
{Name: bk},
|
||||
},
|
||||
Modules: []Package{
|
||||
{Name: "openssh-server", Version: "*"}},
|
||||
Groups: []Group{
|
||||
{Name: "anaconda-tools"}},
|
||||
Customizations: &Customizations{
|
||||
Kernel: &KernelCustomization{
|
||||
Name: ck,
|
||||
},
|
||||
},
|
||||
}
|
||||
Received_packages := bp.GetPackages()
|
||||
// both kernels are included, even if they're the same
|
||||
assert.ElementsMatch(t, []string{"tmux-1.2", bk, "openssh-server", "@anaconda-tools", ck}, Received_packages)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue