Merge ~dannf/canonical-server-hwe-utils:iso-test-matrix into canonical-server-hwe-utils:master

Proposed by dann frazier
Status: Merged
Approved by: Patricia Domingues
Approved revision: 9ddc2c58123fc365484dc22e99cefc353fb05d4c
Merged at revision: 9ddc2c58123fc365484dc22e99cefc353fb05d4c
Proposed branch: ~dannf/canonical-server-hwe-utils:iso-test-matrix
Merge into: canonical-server-hwe-utils:master
Diff against target: 115 lines (+103/-0)
2 files modified
installer-test-matrix/config.yaml (+31/-0)
installer-test-matrix/generate-matrix.py (+72/-0)
Reviewer Review Type Date Requested Status
Patricia Domingues Pending
Review via email: mp+389042@code.launchpad.net
To post a comment you must log in.
Revision history for this message
dann frazier (dannf) wrote :

Sample output:

$ ./generate-matrix.py -r bionic
crb1s pxe GA
crb2s usb-hdd HWE
d05 pxe GA
d05 pxe HWE
d05 cd GA
d05 usb-hdd HWE
sabre pxe GA
taishan2280v2 cd HWE
taishan2280v2 usb-hdd GA
taishan2280v2 pxe HWE
taishan2280v2 pxe GA
$ ./generate-matrix.py -r xenial
crb1s pxe GA
crb2s cd HWE
d05 pxe HWE
d05 usb-hdd HWE
sabre pxe HWE
taishan2280v2 cd HWE
taishan2280v2 pxe HWE

Revision history for this message
Patricia Domingues (patriciasd) wrote :

Great. Many thanks. +1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/installer-test-matrix/config.yaml b/installer-test-matrix/config.yaml
2new file mode 100644
3index 0000000..066623f
4--- /dev/null
5+++ b/installer-test-matrix/config.yaml
6@@ -0,0 +1,31 @@
7+releases:
8+ focal:
9+ boot-options: [ GA ]
10+ bionic:
11+ boot-options: [ GA, HWE ]
12+ xenial:
13+ boot-options: [ GA, HWE ]
14+
15+platforms:
16+ crb1s:
17+ coverage: spot
18+ crb2s:
19+ coverage: spot
20+ d05:
21+ coverage: full
22+ unsupported:
23+ releases:
24+ xenial:
25+ boot-options: GA
26+ sabre:
27+ coverage: spot
28+ unsupported:
29+ releases:
30+ xenial:
31+ boot-options: GA
32+ taishan2280v2:
33+ coverage: full
34+ unsupported:
35+ releases:
36+ xenial:
37+ boot-options: GA
38diff --git a/installer-test-matrix/generate-matrix.py b/installer-test-matrix/generate-matrix.py
39new file mode 100755
40index 0000000..14c2d0a
41--- /dev/null
42+++ b/installer-test-matrix/generate-matrix.py
43@@ -0,0 +1,72 @@
44+#!/usr/bin/env python3
45+
46+import argparse
47+import random
48+import sys
49+import yaml
50+
51+
52+def is_supported(platform_config, release, boot_option):
53+ if "unsupported" not in platform_config.keys():
54+ return True
55+ if "releases" not in platform_config["unsupported"]:
56+ return True
57+ if release not in platform_config["unsupported"]["releases"]:
58+ return True
59+ if "boot-options" not in platform_config["unsupported"]["releases"][release].keys():
60+ return False
61+ if (
62+ boot_option
63+ in platform_config["unsupported"]["releases"][release]["boot-options"]
64+ ):
65+ return False
66+ return True
67+
68+
69+if __name__ == "__main__":
70+ parser = argparse.ArgumentParser()
71+ parser.add_argument("--config", "-c", default="./config.yaml")
72+ parser.add_argument("--release", "-r", required=True)
73+ args = parser.parse_args()
74+
75+ with open(args.config, "r") as f:
76+ y = yaml.load(f, Loader=yaml.SafeLoader)
77+ release = y["releases"][args.release]
78+
79+ # Create shuffled lists of the various install
80+ # config variables. We'll round-robin through them.
81+ boot_options = release["boot-options"][:]
82+ random.shuffle(boot_options)
83+ media_options = ["iso", "pxe"]
84+ random.shuffle(media_options)
85+ cd_hdd = ["cd", "usb-hdd"]
86+ random.shuffle(cd_hdd)
87+
88+ for platform in y["platforms"]:
89+ p = y["platforms"][platform]
90+ done = False
91+ for m in range(len(media_options)):
92+ if done:
93+ break
94+ # pop/append pattern creates a circular queue
95+ media_type = media_options.pop(0)
96+ media_options.append(media_type)
97+ for b in range(len(boot_options)):
98+ boot_type = boot_options.pop(0)
99+ boot_options.append(boot_type)
100+ if not is_supported(p, args.release, boot_type):
101+ continue
102+ # Alternate between booting the ISO as a CD
103+ # and as a USB stick. Both create a nearly identical
104+ # install environment, so we don't consider them
105+ # separate media types.
106+ if media_type == "iso":
107+ media_string = cd_hdd.pop(0)
108+ cd_hdd.append(media_string)
109+ else:
110+ media_string = media_type
111+ sys.stdout.write("%s %s %s\n" % (platform, media_string, boot_type))
112+ if p["coverage"] == "spot":
113+ # We only need 1 case for spot testing
114+ done = True
115+ break

Subscribers

People subscribed via source and target branches

to all changes: