test/cases: move checksum out of the compose struct

The intention is that the compose struct fully specifies the test
case, and pipeline and image-info specifies the expected outputs.
Lastly, the boot struct specifies how to boot-test the image.

The checksum does not fit into this scheme, as it is computed from
the compose by querying rpmmd, and it is then passed as an input to
distro.Pipeline in order to compute the pipeline.

Introduce a new struct, rpmmd, which will eventually contain all
the data returned from rpmmd.Depsolve and later passed to
distro.Pipeline. For now it only contains the checksum.

This is not a functional change.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-03-08 18:30:56 +01:00
parent 3cff0a2578
commit fbf137a1b7
25 changed files with 134 additions and 59 deletions

View file

@ -24,11 +24,14 @@ func TestDistro_Pipeline(t *testing.T) {
Distro string `json:"distro"`
Arch string `json:"arch"`
OutputFormat string `json:"output-format"`
Checksums map[string]string `json:"checksums"`
Blueprint *blueprint.Blueprint `json:"blueprint"`
}
type rpmMD struct {
Checksums map[string]string `json:"checksums"`
}
var tt struct {
Compose *compose `json:"compose"`
RpmMD *rpmMD `json:"rpmmd"`
Pipeline *osbuild.Pipeline `json:"pipeline,omitempty"`
}
file, err := ioutil.ReadFile(pipelinePath + fileInfo.Name())
@ -54,7 +57,7 @@ func TestDistro_Pipeline(t *testing.T) {
return
}
size := d.GetSizeForOutputType(tt.Compose.OutputFormat, 0)
got, err := d.Pipeline(tt.Compose.Blueprint, nil, nil, nil, tt.Compose.Checksums, tt.Compose.Arch, tt.Compose.OutputFormat, size)
got, err := d.Pipeline(tt.Compose.Blueprint, nil, nil, nil, tt.RpmMD.Checksums, tt.Compose.Arch, tt.Compose.OutputFormat, size)
if (err != nil) != (tt.Pipeline == nil) {
t.Errorf("distro.Pipeline() error = %v", err)
return

View file

@ -5,13 +5,15 @@
"compose": {
"distro": "fedora-30",
"arch": "x86_64",
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
},
"filename": "image.raw.xz",
"output-format": "ami",
"blueprint": {}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -2,13 +2,15 @@
"compose": {
"distro": "fedora-30",
"arch": "x86_64",
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
},
"output-format": "partitioned-disk",
"filename": "disk.img",
"blueprint": {}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -37,6 +37,11 @@
}
}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -2,13 +2,15 @@
"compose": {
"distro": "fedora-30",
"arch": "x86_64",
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
},
"output-format": "ext4-filesystem",
"filename": "filesystem.img",
"blueprint": {}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -37,6 +37,11 @@
}
}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -41,6 +41,11 @@
}
}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -2,13 +2,15 @@
"compose": {
"distro": "fedora-30",
"arch": "x86_64",
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
},
"output-format": "openstack",
"filename": "disk.qcow2",
"blueprint": {}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -37,6 +37,11 @@
}
}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -2,13 +2,15 @@
"compose": {
"distro": "fedora-30",
"arch": "x86_64",
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
},
"output-format": "qcow2",
"filename": "disk.qcow2",
"blueprint": {}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -37,6 +37,11 @@
}
}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -5,14 +5,16 @@
"compose": {
"distro": "rhel-8.2",
"arch": "x86_64",
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
},
"filename": "image.raw.xz",
"output-format": "ami",
"blueprint": {}
},
"rpmmd": {
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -2,10 +2,6 @@
"compose": {
"distro": "rhel-8.2",
"arch": "x86_64",
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
},
"filename": "filesystem.img",
"output-format": "ext4-filesystem",
"blueprint": {
@ -19,6 +15,12 @@
}
}
},
"rpmmd": {
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -3,10 +3,6 @@
"output-format": "tar",
"distro": "rhel-8.2",
"arch": "x86_64",
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
},
"filename": "root.tar.xz",
"blueprint": {
"groups": [
@ -24,6 +20,12 @@
}
}
},
"rpmmd": {
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -5,14 +5,16 @@
"compose": {
"distro": "rhel-8.2",
"arch": "x86_64",
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
},
"filename": "disk.qcow2",
"output-format": "openstack",
"blueprint": {}
},
"rpmmd": {
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -2,10 +2,6 @@
"compose": {
"distro": "rhel-8.2",
"arch": "x86_64",
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
},
"filename": "disk.img",
"output-format": "partitioned-disk",
"blueprint": {
@ -19,6 +15,12 @@
}
}
},
"rpmmd": {
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -5,14 +5,16 @@
"compose": {
"distro": "rhel-8.2",
"arch": "x86_64",
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
},
"filename": "disk.qcow2",
"output-format": "qcow2",
"blueprint": {}
},
"rpmmd": {
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -3,10 +3,6 @@
"output-format": "tar",
"distro": "rhel-8.2",
"arch": "x86_64",
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
},
"filename": "root.tar.xz",
"blueprint": {
"customizations": {
@ -19,6 +15,12 @@
}
}
},
"rpmmd": {
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -5,14 +5,16 @@
"compose": {
"distro": "rhel-8.2",
"arch": "x86_64",
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
},
"filename": "disk.vhd",
"output-format": "vhd",
"blueprint": {}
},
"rpmmd": {
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -5,10 +5,6 @@
"compose": {
"distro": "rhel-8.2",
"arch": "x86_64",
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
},
"filename": "disk.vmdk",
"output-format": "vmdk",
"blueprint": {
@ -22,6 +18,12 @@
}
}
},
"rpmmd": {
"checksums": {
"baseos": "sha256:3ce6f4ffa7d05b81fec2ba5a1c4917b351231c3433f2f5eed86ed5f8f97168a1",
"appstream": "sha256:662e1dc0e465dd5e8efec9f42ef24ac9fd8418294254c3c98ea0342d6e903aed"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -37,6 +37,11 @@
}
}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -2,13 +2,15 @@
"compose": {
"distro": "fedora-30",
"arch": "x86_64",
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
},
"output-format": "vhd",
"filename": "disk.vhd",
"blueprint": {}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -37,6 +37,11 @@
}
}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -2,13 +2,15 @@
"compose": {
"distro": "fedora-30",
"arch": "x86_64",
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
},
"output-format": "vmdk",
"filename": "disk.vmdk",
"blueprint": {}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {

View file

@ -37,6 +37,11 @@
}
}
},
"rpmmd": {
"checksums": {
"fedora": "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97"
}
},
"pipeline": {
"build": {
"pipeline": {