Skip to content

Commit b5306e4

Browse files
committed
Remove redundant stand-alone check scripts, improve documentation
Signed-off-by: Matthias Büchse <[email protected]>
1 parent 2ef8e94 commit b5306e4

File tree

19 files changed

+102
-1653
lines changed

19 files changed

+102
-1653
lines changed

Tests/iaas/scs_0100_flavor_naming/flavor-names-openstack.py

Lines changed: 0 additions & 108 deletions
This file was deleted.

Tests/iaas/scs_0100_flavor_naming/flavor_names_check.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#!/usr/bin/env python3
2-
# vim: set ts=4 sw=4 et:
3-
41
import logging
52
import typing
63

@@ -22,6 +19,12 @@
2219

2320

2421
def compute_scs_flavors(flavors: typing.List[openstack.compute.v2.flavor.Flavor], parser=STRATEGY) -> list:
22+
"""
23+
Precompute the Flavorname instance for each openstack flavor where applicable.
24+
25+
Returns a list of pairs of the form (flavor, flavorname_instance_or_none).
26+
This information is (re)used for multiple testcases.
27+
"""
2528
result = []
2629
for flv in flavors:
2730
if not flv.name or flv.name[:4] != 'SCS-':
@@ -41,13 +44,21 @@ def compute_flavor_spec(canonical_name: str) -> dict:
4144

4245

4346
def compute_scs_0100_syntax_check(scs_flavors: list) -> bool:
47+
"""This test ensures that each SCS flavor is indeed named correctly."""
4448
problems = [flv.name for flv, flavorname in scs_flavors if not flavorname]
4549
if problems:
4650
logger.error(f"scs-100-syntax-check: flavor(s) failed: {', '.join(sorted(problems))}")
4751
return not problems
4852

4953

5054
def compute_scs_0100_semantics_check(scs_flavors: list) -> bool:
55+
"""
56+
This test ensures that each SCS flavor 'does what it says on the tin'.
57+
58+
In particular, no flavor name may overpromise anything.
59+
NOTE that this test is incomplete; it only checks the most obvious properties.
60+
See also <https://github.com/SovereignCloudStack/standards/issues/554>.
61+
"""
5162
problems = set()
5263
for flv, flavorname in scs_flavors:
5364
if not flavorname:

Tests/iaas/scs_0101_entropy/entropy-check.py

Lines changed: 0 additions & 124 deletions
This file was deleted.

Tests/iaas/scs_0101_entropy/entropy_check.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060

6161
def compute_scs_0101_image_property(images, attributes=IMAGE_ATTRIBUTES):
62+
"""This test ensures that each image has the relevant properties."""
6263
candidates = [
6364
(image.name, [f"{key}={value}" for key, value in attributes.items() if image.get(key) != value])
6465
for image in images
@@ -71,6 +72,7 @@ def compute_scs_0101_image_property(images, attributes=IMAGE_ATTRIBUTES):
7172

7273

7374
def compute_scs_0101_flavor_property(flavors, attributes=FLAVOR_ATTRIBUTES, optional=FLAVOR_OPTIONAL):
75+
"""This test ensures that each flavor has the relevant extra_spec."""
7476
offenses = 0
7577
for flavor in flavors:
7678
extra_specs = flavor['extra_specs']
@@ -89,6 +91,7 @@ def compute_scs_0101_flavor_property(flavors, attributes=FLAVOR_ATTRIBUTES, opti
8991

9092

9193
def compute_scs_0101_entropy_avail(collected_vm_output, image_name):
94+
"""This test ensures that the `entropy_avail` value is correct for a test VM."""
9295
lines = collected_vm_output['entropy-avail']
9396
entropy_avail = lines[0].strip()
9497
if entropy_avail != "256":
@@ -101,6 +104,7 @@ def compute_scs_0101_entropy_avail(collected_vm_output, image_name):
101104

102105

103106
def compute_scs_0101_rngd(collected_vm_output, image_name):
107+
"""This test ensures that the `rngd` service is running on a test VM."""
104108
lines = collected_vm_output['rngd']
105109
if "could not be found" in '\n'.join(lines):
106110
logger.error(f"VM '{image_name}' doesn't provide the recommended service rngd")
@@ -109,6 +113,7 @@ def compute_scs_0101_rngd(collected_vm_output, image_name):
109113

110114

111115
def compute_scs_0101_fips_test(collected_vm_output, image_name):
116+
"""This test ensures that the 'fips test' via `rngtest` is passed on a test VM."""
112117
lines = collected_vm_output['fips-test']
113118
try:
114119
fips_data = '\n'.join(lines)
@@ -137,6 +142,7 @@ def compute_scs_0101_fips_test(collected_vm_output, image_name):
137142

138143
# FIXME this is not actually being used AFAICT -- mbuechse
139144
def compute_scs_0101_virtio_rng(collected_vm_output, image_name):
145+
"""This test ensures that the virtualized rng device is value inside a test VM."""
140146
lines = collected_vm_output['virtio-rng']
141147
try:
142148
# `cat` can fail with return code 1 if special file does not exist
@@ -345,7 +351,7 @@ def _convert_to_collected(lines, marker=MARKER):
345351

346352

347353
def compute_collected_vm_output(conn, all_flavors, image):
348-
# Check a VM for services and requirements
354+
"""Creates a test VM, collects and returns its output for later evaluation."""
349355
logger.debug(f"Selected image: {image.name} ({image.id})")
350356
flavor = select_flavor_for_image(all_flavors, image)
351357
userdata = SERVER_USERDATA.get(image.os_distro, SERVER_USERDATA_GENERIC)

0 commit comments

Comments
 (0)