test/cases: rename compose -> compose-request

This is to avoid any confusion with the Compose struct in the store,
which contains the pinned rpmmd data and the pipeline, among other
things.

The struct in the test cases represent the user input to the compose
route, so rename it 'compose-request', to make that clearer.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-03-08 19:53:21 +01:00
parent d7297e569d
commit caca553a8f
26 changed files with 39 additions and 39 deletions

View file

@ -21,7 +21,7 @@ func TestDistro_Pipeline(t *testing.T) {
t.Errorf("Could not read pipelines directory '%s': %v", pipelinePath, err)
}
for _, fileInfo := range fileInfos {
type compose struct {
type composeRequest struct {
Distro string `json:"distro"`
Arch string `json:"arch"`
OutputFormat string `json:"output-format"`
@ -33,9 +33,9 @@ func TestDistro_Pipeline(t *testing.T) {
Checksums map[string]string `json:"checksums"`
}
var tt struct {
Compose *compose `json:"compose"`
RpmMD *rpmMD `json:"rpmmd"`
Pipeline *osbuild.Pipeline `json:"pipeline,omitempty"`
ComposeRequest *composeRequest `json:"compose-request"`
RpmMD *rpmMD `json:"rpmmd"`
Pipeline *osbuild.Pipeline `json:"pipeline,omitempty"`
}
file, err := ioutil.ReadFile(pipelinePath + fileInfo.Name())
if err != nil {
@ -45,28 +45,28 @@ func TestDistro_Pipeline(t *testing.T) {
if err != nil {
t.Errorf("Colud not parse test-case '%s': %v", fileInfo.Name(), err)
}
if tt.Compose == nil || tt.Compose.Blueprint == nil {
if tt.ComposeRequest == nil || tt.ComposeRequest.Blueprint == nil {
t.Logf("Skipping '%s'.", fileInfo.Name())
continue
}
t.Run(tt.Compose.OutputFormat, func(t *testing.T) {
t.Run(tt.ComposeRequest.OutputFormat, func(t *testing.T) {
distros, err := distro.NewDefaultRegistry([]string{"../.."})
if err != nil {
t.Fatal(err)
}
d := distros.GetDistro(tt.Compose.Distro)
d := distros.GetDistro(tt.ComposeRequest.Distro)
if d == nil {
t.Errorf("unknown distro: %v", tt.Compose.Distro)
t.Errorf("unknown distro: %v", tt.ComposeRequest.Distro)
return
}
size := d.GetSizeForOutputType(tt.Compose.OutputFormat, 0)
got, err := d.Pipeline(tt.Compose.Blueprint,
size := d.GetSizeForOutputType(tt.ComposeRequest.OutputFormat, 0)
got, err := d.Pipeline(tt.ComposeRequest.Blueprint,
nil,
tt.RpmMD.Packages,
tt.RpmMD.BuildPackages,
tt.RpmMD.Checksums,
tt.Compose.Arch,
tt.Compose.OutputFormat,
tt.ComposeRequest.Arch,
tt.ComposeRequest.OutputFormat,
size)
if (err != nil) != (tt.Pipeline == nil) {
t.Errorf("distro.Pipeline() error = %v", err)

View file

@ -2,7 +2,7 @@
"boot": {
"type": "qemu-extract"
},
"compose": {
"compose-request": {
"distro": "fedora-30",
"arch": "x86_64",
"filename": "image.raw.xz",

View file

@ -1,5 +1,5 @@
{
"compose": {
"compose-request": {
"distro": "fedora-30",
"arch": "x86_64",
"output-format": "partitioned-disk",

View file

@ -2,7 +2,7 @@
"boot": {
"type": "nspawn"
},
"compose": {
"compose-request": {
"distro": "fedora-30",
"arch": "x86_64",
"output-format": "partitioned-disk",

View file

@ -1,5 +1,5 @@
{
"compose": {
"compose-request": {
"distro": "fedora-30",
"arch": "x86_64",
"output-format": "ext4-filesystem",

View file

@ -2,7 +2,7 @@
"boot": {
"type": "nspawn"
},
"compose": {
"compose-request": {
"distro": "fedora-30",
"arch": "x86_64",
"output-format": "ext4",

View file

@ -2,7 +2,7 @@
"boot": {
"type": "nspawn-extract"
},
"compose": {
"compose-request": {
"output-format": "tar",
"distro": "fedora-30",
"arch": "x86_64",

View file

@ -1,5 +1,5 @@
{
"compose": {
"compose-request": {
"distro": "fedora-30",
"arch": "x86_64",
"output-format": "openstack",

View file

@ -2,7 +2,7 @@
"boot": {
"type": "qemu"
},
"compose": {
"compose-request": {
"distro": "fedora-30",
"arch": "x86_64",
"output-format": "openstack",

View file

@ -1,5 +1,5 @@
{
"compose": {
"compose-request": {
"distro": "fedora-30",
"arch": "x86_64",
"output-format": "qcow2",

View file

@ -2,7 +2,7 @@
"boot": {
"type": "qemu"
},
"compose": {
"compose-request": {
"distro": "fedora-30",
"arch": "x86_64",
"output-format": "qcow2",

View file

@ -2,7 +2,7 @@
"boot": {
"type": "qemu-extract"
},
"compose": {
"compose-request": {
"distro": "rhel-8.2",
"arch": "x86_64",
"filename": "image.raw.xz",

View file

@ -1,5 +1,5 @@
{
"compose": {
"compose-request": {
"distro": "rhel-8.2",
"arch": "x86_64",
"filename": "filesystem.img",

View file

@ -1,5 +1,5 @@
{
"compose": {
"compose-request": {
"output-format": "tar",
"distro": "rhel-8.2",
"arch": "x86_64",

View file

@ -2,7 +2,7 @@
"boot": {
"type": "qemu"
},
"compose": {
"compose-request": {
"distro": "rhel-8.2",
"arch": "x86_64",
"filename": "disk.qcow2",

View file

@ -1,5 +1,5 @@
{
"compose": {
"compose-request": {
"distro": "rhel-8.2",
"arch": "x86_64",
"filename": "disk.img",

View file

@ -2,7 +2,7 @@
"boot": {
"type": "qemu"
},
"compose": {
"compose-request": {
"distro": "rhel-8.2",
"arch": "x86_64",
"filename": "disk.qcow2",

View file

@ -1,5 +1,5 @@
{
"compose": {
"compose-request": {
"output-format": "tar",
"distro": "rhel-8.2",
"arch": "x86_64",

View file

@ -2,7 +2,7 @@
"boot": {
"type": "qemu"
},
"compose": {
"compose-request": {
"distro": "rhel-8.2",
"arch": "x86_64",
"filename": "disk.vhd",

View file

@ -2,7 +2,7 @@
"boot": {
"type": "qemu"
},
"compose": {
"compose-request": {
"distro": "rhel-8.2",
"arch": "x86_64",
"filename": "disk.vmdk",

View file

@ -2,7 +2,7 @@
"boot": {
"type": "nspawn-extract"
},
"compose": {
"compose-request": {
"output-format": "tar",
"distro": "fedora-30",
"arch": "x86_64",

View file

@ -1,5 +1,5 @@
{
"compose": {
"compose-request": {
"distro": "fedora-30",
"arch": "x86_64",
"output-format": "vhd",

View file

@ -2,7 +2,7 @@
"boot": {
"type": "qemu"
},
"compose": {
"compose-request": {
"distro": "fedora-30",
"arch": "x86_64",
"output-format": "vhd",

View file

@ -1,5 +1,5 @@
{
"compose": {
"compose-request": {
"distro": "fedora-30",
"arch": "x86_64",
"output-format": "vmdk",

View file

@ -2,7 +2,7 @@
"boot": {
"type": "qemu"
},
"compose": {
"compose-request": {
"distro": "fedora-30",
"arch": "x86_64",
"output-format": "vmdk",

View file

@ -194,7 +194,7 @@ def run_test(case, private_key, store):
print(f"osbuild successfully built pipeline {output_id}")
filename = os.path.join(store, "refs", output_id, case["compose"]["filename"])
filename = os.path.join(store, "refs", output_id, case["compose-request"]["filename"])
fn, ex = os.path.splitext(filename)
if ex == ".xz":
@ -248,11 +248,11 @@ def main():
case = json.load(f)
if arg.distros:
if case["compose"]["distro"] not in arg.distros:
if case["compose-request"]["distro"] not in arg.distros:
continue
if arg.arches:
if case["compose"]["arch"] not in arg.arches:
if case["compose-request"]["arch"] not in arg.arches:
continue
print(f"RUNNING: {filename}")