Skip to content

Commit 6f57a41

Browse files
committed
Address comments: consolidate utility constants into test file and remove unused utils module
Signed-off-by: Emanuele Prella <eprella@redhat.com>
1 parent 0bdef9a commit 6f57a41

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

tests/storage/cdi_config/test_cdi_config.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
# -*- coding: utf-8 -*-
2-
31
"""CDIConfig tests"""
42

53
import pytest
64
from ocp_resources.cdi import CDI
75
from ocp_resources.route import Route
86
from timeout_sampler import TimeoutSampler
97

10-
from tests.storage.cdi_config.utils import (
11-
INSECURE_REGISTRIES_LIST,
12-
NON_EXISTENT_SCRATCH_SC_DICT,
13-
STORAGE_WORKLOADS_DICT,
14-
)
158
from tests.storage.utils import LOGGER
169
from utilities.constants import CDI_UPLOADPROXY
1710
from utilities.hco import ResourceEditorValidateHCOReconcile
1811

1912
pytestmark = pytest.mark.post_upgrade
2013

14+
STORAGE_WORKLOADS_DICT = {
15+
"limits": {"cpu": "505m", "memory": "2Gi"},
16+
"requests": {"cpu": "252m", "memory": "1Gi"},
17+
}
18+
NON_EXISTENT_SCRATCH_SC_DICT = {"scratchSpaceStorageClass": "NonExistentSC"}
19+
INSECURE_REGISTRIES_LIST = ["added-private-registry:5000"]
20+
2121

2222
@pytest.mark.sno
2323
@pytest.mark.gating
@@ -137,6 +137,10 @@ def _verify_propagation():
137137
**expected_in_cdi_config_from_cr,
138138
} == current_cdi_config_from_cr
139139

140+
def _verify_revert() -> bool:
141+
current_cdi_config_from_cr = cdi.instance.to_dict()["spec"]["config"]
142+
return current_cdi_config_from_cr == initial_cdi_config_from_cr
143+
140144
with ResourceEditorValidateHCOReconcile(
141145
patches={hyperconverged_resource_scope_module: {"spec": hco_updated_spec_stanza}},
142146
list_resource_reconcile=[CDI],
@@ -150,8 +154,8 @@ def _verify_propagation():
150154

151155
LOGGER.info("Check values revert back to original")
152156
reverted = False
153-
for sample in TimeoutSampler(wait_timeout=20, sleep=1, func=_verify_propagation):
154-
if not sample:
157+
for sample in TimeoutSampler(wait_timeout=20, sleep=1, func=_verify_revert):
158+
if sample:
155159
reverted = True
156160
break
157161
assert reverted, "CDI config did not revert to the original values after restore"

tests/storage/cdi_config/utils.py

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

0 commit comments

Comments
 (0)