Skip to content

Commit 39ba33d

Browse files
committed
Remove unused code for entropy check
Signed-off-by: Matthias Büchse <matthias.buechse@alasca.cloud>
1 parent 7a3deff commit 39ba33d

3 files changed

Lines changed: 0 additions & 62 deletions

File tree

Standards/scs-0101-w1-entropy-implementation-testing.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ checked, because of two reasons: (a) we already check the file `entropy_avail`
3131
(see subsection on Errors), and (b) users can always choose a recent image,
3232
as ensured by the image metadata standard.
3333

34-
Three further testcases are available, but currently unused:
35-
36-
- `scs-0101-image-property` ensures that each flavor has the extra spec `hw_rng:allowed=True`,
37-
- `scs-0101-flavor-property` ensures that each public image has the property `hw_rng_model: virtio`,
38-
- `scs-0101-rngd` ensures that the service `rngd` is present on a sample VM.
39-
4034
## Manual tests
4135

4236
None.

Tests/iaas/openstack_test.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,7 @@ def make_container(cloud):
7373
# scs_0101_entropy
7474
c.add_function('canonical_image', lambda c: compute_canonical_image(c.images))
7575
c.add_function('collected_vm_output', lambda c: compute_collected_vm_output(c.conn, c.flavors, c.canonical_image))
76-
c.add_function('scs_0101_image_property', lambda c: compute_scs_0101_image_property(c.images))
77-
c.add_function('scs_0101_flavor_property', lambda c: compute_scs_0101_flavor_property(c.flavors))
7876
c.add_function('scs_0101_entropy_avail', lambda c: compute_scs_0101_entropy_avail(c.collected_vm_output, c.canonical_image.name))
79-
c.add_function('scs_0101_rngd', lambda c: compute_scs_0101_rngd(c.collected_vm_output, c.canonical_image.name))
8077
c.add_function('scs_0101_fips_test', lambda c: compute_scs_0101_fips_test(c.collected_vm_output, c.canonical_image.name))
8178
# scs_0102_image_metadata
8279
c.add_function('scs_0102_prop_architecture', lambda c: compute_scs_0102_prop_architecture(c.images))

Tests/iaas/scs_0101_entropy/entropy_check.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,6 @@
1717
SECURITY_GROUP_NAME = "_scs-0101-group"
1818
KEYPAIR_NAME = "_scs-0101-keypair"
1919

20-
IMAGE_ATTRIBUTES = {
21-
# https://docs.openstack.org/glance/2023.1/admin/useful-image-properties.html#image-property-keys-and-values
22-
# type: str
23-
"hw_rng_model": "virtio",
24-
}
25-
FLAVOR_ATTRIBUTES = {
26-
# https://docs.openstack.org/nova/2023.1/configuration/extra-specs.html#hw-rng
27-
# type: bool
28-
"hw_rng:allowed": "True", # testing showed that it is indeed a string?
29-
}
30-
FLAVOR_OPTIONAL = ("hw_rng:rate_bytes", "hw_rng:rate_period")
31-
3220

3321
TIMEOUT = 5 * 60 # timeout in seconds after which we no longer wait for the VM to complete the run
3422
MARKER = '_scs-test-'
@@ -70,38 +58,6 @@
7058
}
7159

7260

73-
def compute_scs_0101_image_property(images, attributes=IMAGE_ATTRIBUTES):
74-
"""This test ensures that each image has the relevant properties."""
75-
candidates = [
76-
(image.name, [f"{key}={value}" for key, value in attributes.items() if image.get(key) != value])
77-
for image in images
78-
]
79-
# drop those candidates that are fine
80-
offenders = [candidate for candidate in candidates if candidate[1]]
81-
for name, wrong in offenders:
82-
logger.error(f"Image '{name}' missing attributes: {', '.join(wrong)}")
83-
return not offenders
84-
85-
86-
def compute_scs_0101_flavor_property(flavors, attributes=FLAVOR_ATTRIBUTES, optional=FLAVOR_OPTIONAL):
87-
"""This test ensures that each flavor has the relevant extra_spec."""
88-
offenses = 0
89-
for flavor in flavors:
90-
extra_specs = flavor['extra_specs']
91-
wrong = [f"{key}={value}" for key, value in attributes.items() if extra_specs.get(key) != value]
92-
miss_opt = [key for key in optional if extra_specs.get(key) is None]
93-
if wrong:
94-
offenses += 1
95-
message = f"Flavor '{flavor.name}' missing attributes: {', '.join(wrong)}"
96-
# only report missing optional attributes if main ones are missing as well
97-
# reasoning here is that these optional attributes are merely a hint for implementers
98-
# and if the main ones are present, we assume that implementers have done their job already
99-
if miss_opt:
100-
message += f"; additionally, missing optional attributes: {', '.join(miss_opt)}"
101-
logger.error(message)
102-
return not offenses
103-
104-
10561
def compute_scs_0101_entropy_avail(collected_vm_output, image_name):
10662
"""This test ensures that the `entropy_avail` value is correct for a test VM."""
10763
lines = collected_vm_output['entropy-avail']
@@ -115,15 +71,6 @@ def compute_scs_0101_entropy_avail(collected_vm_output, image_name):
11571
return True
11672

11773

118-
def compute_scs_0101_rngd(collected_vm_output, image_name):
119-
"""This test ensures that the `rngd` service is running on a test VM."""
120-
lines = collected_vm_output['rngd']
121-
if "could not be found" in '\n'.join(lines):
122-
logger.error(f"VM '{image_name}' doesn't provide service rngd")
123-
return False
124-
return True
125-
126-
12774
def compute_scs_0101_fips_test(collected_vm_output, image_name):
12875
"""This test ensures that the 'fips test' via `rngtest` is passed on a test VM."""
12976
lines = collected_vm_output['fips-test']

0 commit comments

Comments
 (0)