Skip to content

Commit f851a3c

Browse files
authored
Relax test frequency expectations across the board (#947)
resolves #936 Signed-off-by: Matthias Büchse <matthias.buechse@alasca.cloud>
1 parent 9abde28 commit f851a3c

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

Standards/scs-0003-v1-sovereign-cloud-standards-yaml.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ TBD
256256
| Key | Type | Description | Example |
257257
| ----------------- | --------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------- |
258258
| `id` | String | Identifier for this test case (immutable and unique within this module) | `image-md-check` |
259-
| `lifetime` | String | One of: `day` (_default_), `week`, `month`, `quarter`; the test result is valid until the end of the next period | `week` |
259+
| `lifetime` | String | One of: `day`, `week` (_default_), `month`, `quarter`, `infinite`; the test result is valid until the end of the next period | `day` |
260260
| `tags` | List of strings | A tag is a keyword that will be used to select this test case using a selector expression | `[mandatory]` |
261261
| `description` | String | Short description of the test case | |
262262

Tests/scs-compatible-kaas.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ modules:
2020
testcases:
2121
- id: cncf-k8s-conformance
2222
tags: [mandatory]
23+
lifetime: infinite
2324
description: >
2425
Must fulfill all requirements of [CNCF Kubernetes conformance](https://github.com/cncf/k8s-conformance/tree/master)
2526
- id: scs-0210-v2

Tests/scs_cert_lib.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,11 @@ def add_period(dt: datetime, period: str) -> datetime:
120120
https://docs.scs.community/standards/scs-0004-v1-achieving-certification#regulations
121121
"""
122122
# compute the moment of expiry (so we are valid before that point, but not on that point)
123-
if period is None or period == 'day': # day is default, so use it if period is None
123+
if period == 'day':
124124
dt += timedelta(days=2)
125125
return datetime(dt.year, dt.month, dt.day) # omit time so as to arrive at midnight
126-
if period == 'week':
126+
# week is default, so use it if period is None
127+
if period is None or period == 'week':
127128
dt += timedelta(days=14 - dt.weekday())
128129
return datetime(dt.year, dt.month, dt.day) # omit time so as to arrive at midnight
129130
if period == 'month':
@@ -140,6 +141,9 @@ def add_period(dt: datetime, period: str) -> datetime:
140141
if dt.month >= 4:
141142
return datetime(dt.year, 10, 1)
142143
return datetime(dt.year, 7, 1)
144+
if period == 'infinite':
145+
# admittedly HACKY, but this case is better handled by caller
146+
return datetime(dt.year + 1000, 1, 1)
143147

144148

145149
def parse_selector(selector_str: str) -> list[list[str]]:

compliance-monitor/monitor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,8 @@ def convert_result_rows_to_dict2(
513513
missing.add((scope_uuid, version, testcase_id))
514514
continue
515515
# drop value if too old
516-
expires_at = add_period(checked_at, testcase.get('lifetime'))
517-
if now >= expires_at:
516+
lifetime = testcase.get('lifetime') # leave None if not present; to be handled by add_period
517+
if lifetime != 'infinite' and now >= add_period(checked_at, lifetime):
518518
continue
519519
tc_result = dict(result=result, checked_at=checked_at)
520520
if include_report:

0 commit comments

Comments
 (0)