blueprint/qcow2: move wanted pipeline into sepratate file
This will allow us to run tests on the generated images from the same files in the future. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
d302ac6d09
commit
5a82c95c9a
2 changed files with 113 additions and 7 deletions
105
internal/blueprint/pipelines/qcow2_empty_blueprint.json
Normal file
105
internal/blueprint/pipelines/qcow2_empty_blueprint.json
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
{
|
||||
"build": {
|
||||
"stages": [
|
||||
{
|
||||
"name": "org.osbuild.dnf",
|
||||
"options": {
|
||||
"repos": [
|
||||
{
|
||||
"metalink": "https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch",
|
||||
"gpgkey": "F1D8 EC98 F241 AAF2 0DF6 9420 EF3C 111F CFC6 59B9",
|
||||
"checksum": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
|
||||
}
|
||||
],
|
||||
"packages": [
|
||||
"dnf",
|
||||
"e2fsprogs",
|
||||
"policycoreutils",
|
||||
"qemu-img",
|
||||
"systemd",
|
||||
"grub2-pc",
|
||||
"tar"
|
||||
],
|
||||
"releasever": "30",
|
||||
"basearch": "x86_64"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"stages": [
|
||||
{
|
||||
"name": "org.osbuild.dnf",
|
||||
"options": {
|
||||
"repos": [
|
||||
{
|
||||
"metalink": "https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch",
|
||||
"gpgkey": "F1D8 EC98 F241 AAF2 0DF6 9420 EF3C 111F CFC6 59B9",
|
||||
"checksum": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
|
||||
}
|
||||
],
|
||||
"packages": [
|
||||
"@Core",
|
||||
"chrony",
|
||||
"kernel",
|
||||
"selinux-policy-targeted",
|
||||
"grub2-pc",
|
||||
"spice-vdagent",
|
||||
"qemu-guest-agent",
|
||||
"xen-libs",
|
||||
"langpacks-en"
|
||||
],
|
||||
"releasever": "30",
|
||||
"basearch": "x86_64"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "org.osbuild.fix-bls",
|
||||
"options": {}
|
||||
},
|
||||
{
|
||||
"name": "org.osbuild.locale",
|
||||
"options": {
|
||||
"language": "en_US"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "org.osbuild.fstab",
|
||||
"options": {
|
||||
"filesystems": [
|
||||
{
|
||||
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"vfs_type": "extf4",
|
||||
"path": "/",
|
||||
"options": "defaults",
|
||||
"freq": 1,
|
||||
"passno": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "org.osbuild.grub2",
|
||||
"options": {
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"boot_fs_uuid": "00000000-0000-0000-0000-000000000000",
|
||||
"kernel_opts": "ro biosdevname=0 net.ifnames=0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "org.osbuild.selinux",
|
||||
"options": {
|
||||
"file_contexts": "etc/selinux/targeted/contexts/files/file_contexts"
|
||||
}
|
||||
}
|
||||
],
|
||||
"assembler": {
|
||||
"name": "org.osbuild.qemu",
|
||||
"options": {
|
||||
"format": "qcow2",
|
||||
"filename": "image.qcow2",
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"size": 3221225472
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package blueprint
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
|
|
@ -12,26 +13,26 @@ func Test_qcow2Output_translate(t *testing.T) {
|
|||
type args struct {
|
||||
b *Blueprint
|
||||
}
|
||||
var emptyPipeline pipeline.Pipeline
|
||||
json.Unmarshal([]byte(`{"build":{"stages":[{"name":"org.osbuild.dnf","options":{"repos":[{"metalink":"https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever\u0026arch=$basearch","gpgkey":"F1D8 EC98 F241 AAF2 0DF6 9420 EF3C 111F CFC6 59B9","checksum":"sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"}],"packages":["dnf","e2fsprogs","policycoreutils","qemu-img","systemd","grub2-pc","tar"],"releasever":"30","basearch":"x86_64"}}]},"stages":[{"name":"org.osbuild.dnf","options":{"repos":[{"metalink":"https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever\u0026arch=$basearch","gpgkey":"F1D8 EC98 F241 AAF2 0DF6 9420 EF3C 111F CFC6 59B9","checksum":"sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"}],"packages":["@Core","chrony","kernel","selinux-policy-targeted","grub2-pc","spice-vdagent","qemu-guest-agent","xen-libs","langpacks-en"],"releasever":"30","basearch":"x86_64"}},{"name":"org.osbuild.fix-bls","options":{}},{"name":"org.osbuild.locale","options":{"language":"en_US"}},{"name":"org.osbuild.fstab","options":{"filesystems":[{"uuid":"76a22bf4-f153-4541-b6c7-0332c0dfaeac","vfs_type":"extf4","path":"/","options":"defaults","freq":1,"passno":1}]}},{"name":"org.osbuild.grub2","options":{"root_fs_uuid":"76a22bf4-f153-4541-b6c7-0332c0dfaeac","boot_fs_uuid":"00000000-0000-0000-0000-000000000000","kernel_opts":"ro biosdevname=0 net.ifnames=0"}},{"name":"org.osbuild.selinux","options":{"file_contexts":"etc/selinux/targeted/contexts/files/file_contexts"}}],"assembler":{"name":"org.osbuild.qemu","options":{"format":"qcow2","filename":"image.qcow2","ptuuid":"0x14fc63d2","root_fs_uuid":"76a22bf4-f153-4541-b6c7-0332c0dfaeac","size":3221225472}}}`),
|
||||
&emptyPipeline)
|
||||
tests := []struct {
|
||||
name string
|
||||
t *qcow2Output
|
||||
args args
|
||||
want *pipeline.Pipeline
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "empty-blueprint",
|
||||
t: &qcow2Output{},
|
||||
args: args{&Blueprint{}},
|
||||
want: &emptyPipeline,
|
||||
want: "pipelines/qcow2_empty_blueprint.json",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := tt.t.translate(tt.args.b); !reflect.DeepEqual(got, tt.want) {
|
||||
t.Errorf("qcow2Output.translate() = %v, want %v", got, tt.want)
|
||||
file, _ := ioutil.ReadFile(tt.want)
|
||||
var want pipeline.Pipeline
|
||||
json.Unmarshal([]byte(file), &want)
|
||||
if got := tt.t.translate(tt.args.b); !reflect.DeepEqual(got, &want) {
|
||||
t.Errorf("qcow2Output.translate() = %v, want %v", got, &want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue