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)
|
||||
}
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"boot": {
|
||||
"type": "qemu-extract"
|
||||
},
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
"filename": "image.raw.xz",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
"output-format": "partitioned-disk",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"boot": {
|
||||
"type": "nspawn"
|
||||
},
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
"output-format": "partitioned-disk",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
"output-format": "ext4-filesystem",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"boot": {
|
||||
"type": "nspawn"
|
||||
},
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
"output-format": "ext4",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"boot": {
|
||||
"type": "nspawn-extract"
|
||||
},
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"output-format": "tar",
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
"output-format": "openstack",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"boot": {
|
||||
"type": "qemu"
|
||||
},
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
"output-format": "openstack",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
"output-format": "qcow2",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"boot": {
|
||||
"type": "qemu"
|
||||
},
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
"output-format": "qcow2",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"boot": {
|
||||
"type": "qemu-extract"
|
||||
},
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "rhel-8.2",
|
||||
"arch": "x86_64",
|
||||
"filename": "image.raw.xz",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "rhel-8.2",
|
||||
"arch": "x86_64",
|
||||
"filename": "filesystem.img",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"output-format": "tar",
|
||||
"distro": "rhel-8.2",
|
||||
"arch": "x86_64",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"boot": {
|
||||
"type": "qemu"
|
||||
},
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "rhel-8.2",
|
||||
"arch": "x86_64",
|
||||
"filename": "disk.qcow2",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "rhel-8.2",
|
||||
"arch": "x86_64",
|
||||
"filename": "disk.img",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"boot": {
|
||||
"type": "qemu"
|
||||
},
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "rhel-8.2",
|
||||
"arch": "x86_64",
|
||||
"filename": "disk.qcow2",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"output-format": "tar",
|
||||
"distro": "rhel-8.2",
|
||||
"arch": "x86_64",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"boot": {
|
||||
"type": "qemu"
|
||||
},
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "rhel-8.2",
|
||||
"arch": "x86_64",
|
||||
"filename": "disk.vhd",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"boot": {
|
||||
"type": "qemu"
|
||||
},
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "rhel-8.2",
|
||||
"arch": "x86_64",
|
||||
"filename": "disk.vmdk",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"boot": {
|
||||
"type": "nspawn-extract"
|
||||
},
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"output-format": "tar",
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
"output-format": "vhd",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"boot": {
|
||||
"type": "qemu"
|
||||
},
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
"output-format": "vhd",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
"output-format": "vmdk",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"boot": {
|
||||
"type": "qemu"
|
||||
},
|
||||
"compose": {
|
||||
"compose-request": {
|
||||
"distro": "fedora-30",
|
||||
"arch": "x86_64",
|
||||
"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}")
|
||||
|
||||
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}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue