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:
parent
d7297e569d
commit
caca553a8f
26 changed files with 39 additions and 39 deletions
|
|
@ -21,7 +21,7 @@ func TestDistro_Pipeline(t *testing.T) {
|
||||||
t.Errorf("Could not read pipelines directory '%s': %v", pipelinePath, err)
|
t.Errorf("Could not read pipelines directory '%s': %v", pipelinePath, err)
|
||||||
}
|
}
|
||||||
for _, fileInfo := range fileInfos {
|
for _, fileInfo := range fileInfos {
|
||||||
type compose struct {
|
type composeRequest struct {
|
||||||
Distro string `json:"distro"`
|
Distro string `json:"distro"`
|
||||||
Arch string `json:"arch"`
|
Arch string `json:"arch"`
|
||||||
OutputFormat string `json:"output-format"`
|
OutputFormat string `json:"output-format"`
|
||||||
|
|
@ -33,9 +33,9 @@ func TestDistro_Pipeline(t *testing.T) {
|
||||||
Checksums map[string]string `json:"checksums"`
|
Checksums map[string]string `json:"checksums"`
|
||||||
}
|
}
|
||||||
var tt struct {
|
var tt struct {
|
||||||
Compose *compose `json:"compose"`
|
ComposeRequest *composeRequest `json:"compose-request"`
|
||||||
RpmMD *rpmMD `json:"rpmmd"`
|
RpmMD *rpmMD `json:"rpmmd"`
|
||||||
Pipeline *osbuild.Pipeline `json:"pipeline,omitempty"`
|
Pipeline *osbuild.Pipeline `json:"pipeline,omitempty"`
|
||||||
}
|
}
|
||||||
file, err := ioutil.ReadFile(pipelinePath + fileInfo.Name())
|
file, err := ioutil.ReadFile(pipelinePath + fileInfo.Name())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -45,28 +45,28 @@ func TestDistro_Pipeline(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Colud not parse test-case '%s': %v", fileInfo.Name(), err)
|
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())
|
t.Logf("Skipping '%s'.", fileInfo.Name())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
t.Run(tt.Compose.OutputFormat, func(t *testing.T) {
|
t.Run(tt.ComposeRequest.OutputFormat, func(t *testing.T) {
|
||||||
distros, err := distro.NewDefaultRegistry([]string{"../.."})
|
distros, err := distro.NewDefaultRegistry([]string{"../.."})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
d := distros.GetDistro(tt.Compose.Distro)
|
d := distros.GetDistro(tt.ComposeRequest.Distro)
|
||||||
if d == nil {
|
if d == nil {
|
||||||
t.Errorf("unknown distro: %v", tt.Compose.Distro)
|
t.Errorf("unknown distro: %v", tt.ComposeRequest.Distro)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
size := d.GetSizeForOutputType(tt.Compose.OutputFormat, 0)
|
size := d.GetSizeForOutputType(tt.ComposeRequest.OutputFormat, 0)
|
||||||
got, err := d.Pipeline(tt.Compose.Blueprint,
|
got, err := d.Pipeline(tt.ComposeRequest.Blueprint,
|
||||||
nil,
|
nil,
|
||||||
tt.RpmMD.Packages,
|
tt.RpmMD.Packages,
|
||||||
tt.RpmMD.BuildPackages,
|
tt.RpmMD.BuildPackages,
|
||||||
tt.RpmMD.Checksums,
|
tt.RpmMD.Checksums,
|
||||||
tt.Compose.Arch,
|
tt.ComposeRequest.Arch,
|
||||||
tt.Compose.OutputFormat,
|
tt.ComposeRequest.OutputFormat,
|
||||||
size)
|
size)
|
||||||
if (err != nil) != (tt.Pipeline == nil) {
|
if (err != nil) != (tt.Pipeline == nil) {
|
||||||
t.Errorf("distro.Pipeline() error = %v", err)
|
t.Errorf("distro.Pipeline() error = %v", err)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"boot": {
|
"boot": {
|
||||||
"type": "qemu-extract"
|
"type": "qemu-extract"
|
||||||
},
|
},
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"filename": "image.raw.xz",
|
"filename": "image.raw.xz",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"output-format": "partitioned-disk",
|
"output-format": "partitioned-disk",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"boot": {
|
"boot": {
|
||||||
"type": "nspawn"
|
"type": "nspawn"
|
||||||
},
|
},
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"output-format": "partitioned-disk",
|
"output-format": "partitioned-disk",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"output-format": "ext4-filesystem",
|
"output-format": "ext4-filesystem",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"boot": {
|
"boot": {
|
||||||
"type": "nspawn"
|
"type": "nspawn"
|
||||||
},
|
},
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"output-format": "ext4",
|
"output-format": "ext4",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"boot": {
|
"boot": {
|
||||||
"type": "nspawn-extract"
|
"type": "nspawn-extract"
|
||||||
},
|
},
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"output-format": "tar",
|
"output-format": "tar",
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"output-format": "openstack",
|
"output-format": "openstack",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"boot": {
|
"boot": {
|
||||||
"type": "qemu"
|
"type": "qemu"
|
||||||
},
|
},
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"output-format": "openstack",
|
"output-format": "openstack",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"output-format": "qcow2",
|
"output-format": "qcow2",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"boot": {
|
"boot": {
|
||||||
"type": "qemu"
|
"type": "qemu"
|
||||||
},
|
},
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"output-format": "qcow2",
|
"output-format": "qcow2",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"boot": {
|
"boot": {
|
||||||
"type": "qemu-extract"
|
"type": "qemu-extract"
|
||||||
},
|
},
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "rhel-8.2",
|
"distro": "rhel-8.2",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"filename": "image.raw.xz",
|
"filename": "image.raw.xz",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "rhel-8.2",
|
"distro": "rhel-8.2",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"filename": "filesystem.img",
|
"filename": "filesystem.img",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"output-format": "tar",
|
"output-format": "tar",
|
||||||
"distro": "rhel-8.2",
|
"distro": "rhel-8.2",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"boot": {
|
"boot": {
|
||||||
"type": "qemu"
|
"type": "qemu"
|
||||||
},
|
},
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "rhel-8.2",
|
"distro": "rhel-8.2",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"filename": "disk.qcow2",
|
"filename": "disk.qcow2",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "rhel-8.2",
|
"distro": "rhel-8.2",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"filename": "disk.img",
|
"filename": "disk.img",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"boot": {
|
"boot": {
|
||||||
"type": "qemu"
|
"type": "qemu"
|
||||||
},
|
},
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "rhel-8.2",
|
"distro": "rhel-8.2",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"filename": "disk.qcow2",
|
"filename": "disk.qcow2",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"output-format": "tar",
|
"output-format": "tar",
|
||||||
"distro": "rhel-8.2",
|
"distro": "rhel-8.2",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"boot": {
|
"boot": {
|
||||||
"type": "qemu"
|
"type": "qemu"
|
||||||
},
|
},
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "rhel-8.2",
|
"distro": "rhel-8.2",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"filename": "disk.vhd",
|
"filename": "disk.vhd",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"boot": {
|
"boot": {
|
||||||
"type": "qemu"
|
"type": "qemu"
|
||||||
},
|
},
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "rhel-8.2",
|
"distro": "rhel-8.2",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"filename": "disk.vmdk",
|
"filename": "disk.vmdk",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"boot": {
|
"boot": {
|
||||||
"type": "nspawn-extract"
|
"type": "nspawn-extract"
|
||||||
},
|
},
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"output-format": "tar",
|
"output-format": "tar",
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"output-format": "vhd",
|
"output-format": "vhd",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"boot": {
|
"boot": {
|
||||||
"type": "qemu"
|
"type": "qemu"
|
||||||
},
|
},
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"output-format": "vhd",
|
"output-format": "vhd",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"output-format": "vmdk",
|
"output-format": "vmdk",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"boot": {
|
"boot": {
|
||||||
"type": "qemu"
|
"type": "qemu"
|
||||||
},
|
},
|
||||||
"compose": {
|
"compose-request": {
|
||||||
"distro": "fedora-30",
|
"distro": "fedora-30",
|
||||||
"arch": "x86_64",
|
"arch": "x86_64",
|
||||||
"output-format": "vmdk",
|
"output-format": "vmdk",
|
||||||
|
|
|
||||||
6
test/run
6
test/run
|
|
@ -194,7 +194,7 @@ def run_test(case, private_key, store):
|
||||||
|
|
||||||
print(f"osbuild successfully built pipeline {output_id}")
|
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)
|
fn, ex = os.path.splitext(filename)
|
||||||
if ex == ".xz":
|
if ex == ".xz":
|
||||||
|
|
@ -248,11 +248,11 @@ def main():
|
||||||
case = json.load(f)
|
case = json.load(f)
|
||||||
|
|
||||||
if arg.distros:
|
if arg.distros:
|
||||||
if case["compose"]["distro"] not in arg.distros:
|
if case["compose-request"]["distro"] not in arg.distros:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if arg.arches:
|
if arg.arches:
|
||||||
if case["compose"]["arch"] not in arg.arches:
|
if case["compose-request"]["arch"] not in arg.arches:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print(f"RUNNING: {filename}")
|
print(f"RUNNING: {filename}")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue