|
6 | 6 |
|
7 | 7 | from kubernetes.client import V1ObjectMeta
|
8 | 8 |
|
9 |
| -from consts import CREATE_BY_ANNOTATION, LAST_SYNC_ANNOTATION, VERSION_ANNOTATION, BLACK_LISTED_ANNOTATIONS, \ |
10 |
| - BLACK_LISTED_LABELS, CREATE_BY_AUTHOR, CLUSTER_SECRET_LABEL |
| 9 | +from consts import CREATE_BY_ANNOTATION, LAST_SYNC_ANNOTATION, VERSION_ANNOTATION, BLOCKED_ANNOTATIONS, \ |
| 10 | + CREATE_BY_AUTHOR, CLUSTER_SECRET_LABEL |
11 | 11 | from kubernetes_utils import get_ns_list, create_secret_metadata
|
12 |
| -from os_utils import get_version |
| 12 | +from os_utils import get_version, get_blocked_labels |
13 | 13 |
|
14 | 14 | USER_NAMESPACE_COUNT = 10
|
15 | 15 | initial_namespaces = ['default', 'kube-node-lease', 'kube-public', 'kube-system']
|
@@ -99,9 +99,9 @@ def test_create_secret_metadata(self) -> None:
|
99 | 99 | (LAST_SYNC_ANNOTATION, is_iso_format)
|
100 | 100 | ]
|
101 | 101 |
|
102 |
| - attributes_black_lists = dict( |
103 |
| - labels=BLACK_LISTED_LABELS, |
104 |
| - annotations=BLACK_LISTED_ANNOTATIONS, |
| 102 | + attributes_blocked_lists = dict( |
| 103 | + labels=get_blocked_labels(), |
| 104 | + annotations=BLOCKED_ANNOTATIONS, |
105 | 105 | )
|
106 | 106 |
|
107 | 107 | test_cases: list[Tuple[dict[str, str], dict[str, str]]] = [
|
@@ -140,15 +140,15 @@ def test_create_secret_metadata(self) -> None:
|
140 | 140 |
|
141 | 141 | self.assertIsInstance(obj=subject, cls=V1ObjectMeta, msg='returned value has correct type')
|
142 | 142 |
|
143 |
| - for attribute, black_list in attributes_black_lists.items(): |
| 143 | + for attribute, blocked_list in attributes_blocked_lists.items(): |
144 | 144 | attribute_object = subject.__getattribute__(attribute)
|
145 | 145 | self.assertIsNotNone(obj=attribute_object, msg=f'attribute "{attribute}" is not None')
|
146 | 146 |
|
147 | 147 | for key in attribute_object.keys():
|
148 | 148 | self.assertIsInstance(obj=key, cls=str, msg=f'the {attribute} key is a string')
|
149 |
| - for black_listed_label_prefix in black_list: |
| 149 | + for blocked_listed_label_prefix in blocked_list: |
150 | 150 | self.assertFalse(
|
151 |
| - expr=key.startswith(black_listed_label_prefix), |
| 151 | + expr=key.startswith(blocked_listed_label_prefix), |
152 | 152 | msg=f'{attribute} key does not match black listed prefix'
|
153 | 153 | )
|
154 | 154 |
|
|
0 commit comments