5959
6060
6161def 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
7374def 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
9193def 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
103106def 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
111115def 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
139144def 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
347353def 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