1- # -*- coding: utf-8 -*-
2-
31"""CDIConfig tests"""
42
53import pytest
64from ocp_resources .cdi import CDI
75from ocp_resources .route import Route
86from 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- )
158from tests .storage .utils import LOGGER
169from utilities .constants import CDI_UPLOADPROXY
1710from utilities .hco import ResourceEditorValidateHCOReconcile
1811
1912pytestmark = 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"
0 commit comments