|
11 | 11 |
|
12 | 12 | from node_cli.configs import NODE_DATA_PATH, SCHAINS_MNT_DIR_REGULAR, SCHAINS_MNT_DIR_SINGLE_CHAIN |
13 | 13 | from node_cli.configs.resource_allocation import RESOURCE_ALLOCATION_FILEPATH |
14 | | -from node_cli.configs.user import SkaleUserConfig |
15 | 14 | from node_cli.core.node import ( |
| 15 | + compose_node_env, |
16 | 16 | get_expected_container_names, |
17 | | - is_base_containers_alive, |
18 | 17 | init, |
| 18 | + is_base_containers_alive, |
| 19 | + is_update_safe, |
19 | 20 | pack_dir, |
20 | 21 | update, |
21 | | - is_update_safe, |
22 | | - compose_node_env, |
23 | 22 | ) |
24 | 23 | from node_cli.utils.meta import CliMeta |
25 | 24 | from node_cli.utils.node_type import NodeType |
26 | | - |
27 | 25 | from tests.helper import response_mock, safe_update_api_response, subprocess_run_mock |
28 | 26 | from tests.resources_test import BIG_DISK_SIZE |
29 | 27 |
|
@@ -154,11 +152,56 @@ def test_is_base_containers_alive_empty(node_type, is_boot): |
154 | 152 | 'expect_flask_key, expect_backup_run' |
155 | 153 | ), |
156 | 154 | [ |
157 | | - (NodeType.REGULAR, 'regular_user_conf', False, True, False, SCHAINS_MNT_DIR_REGULAR, True, False), |
158 | | - (NodeType.REGULAR, 'regular_user_conf', False, True, True, SCHAINS_MNT_DIR_REGULAR, True, True), |
159 | | - (NodeType.SYNC, 'sync_user_conf', False, False, False, SCHAINS_MNT_DIR_SINGLE_CHAIN, False, False), |
160 | | - (NodeType.MIRAGE, 'mirage_boot_user_conf', True, True, False, SCHAINS_MNT_DIR_SINGLE_CHAIN, True, False), |
161 | | - (NodeType.MIRAGE, 'mirage_user_conf', False, True, False, SCHAINS_MNT_DIR_SINGLE_CHAIN, True, False), |
| 155 | + ( |
| 156 | + NodeType.REGULAR, |
| 157 | + 'regular_user_conf', |
| 158 | + False, |
| 159 | + True, |
| 160 | + False, |
| 161 | + SCHAINS_MNT_DIR_REGULAR, |
| 162 | + True, |
| 163 | + False, |
| 164 | + ), |
| 165 | + ( |
| 166 | + NodeType.REGULAR, |
| 167 | + 'regular_user_conf', |
| 168 | + False, |
| 169 | + True, |
| 170 | + True, |
| 171 | + SCHAINS_MNT_DIR_REGULAR, |
| 172 | + True, |
| 173 | + True, |
| 174 | + ), |
| 175 | + ( |
| 176 | + NodeType.SYNC, |
| 177 | + 'sync_user_conf', |
| 178 | + False, |
| 179 | + False, |
| 180 | + False, |
| 181 | + SCHAINS_MNT_DIR_SINGLE_CHAIN, |
| 182 | + False, |
| 183 | + False, |
| 184 | + ), |
| 185 | + ( |
| 186 | + NodeType.MIRAGE, |
| 187 | + 'mirage_boot_user_conf', |
| 188 | + True, |
| 189 | + True, |
| 190 | + False, |
| 191 | + SCHAINS_MNT_DIR_SINGLE_CHAIN, |
| 192 | + True, |
| 193 | + False, |
| 194 | + ), |
| 195 | + ( |
| 196 | + NodeType.MIRAGE, |
| 197 | + 'mirage_user_conf', |
| 198 | + False, |
| 199 | + True, |
| 200 | + False, |
| 201 | + SCHAINS_MNT_DIR_SINGLE_CHAIN, |
| 202 | + True, |
| 203 | + False, |
| 204 | + ), |
162 | 205 | ], |
163 | 206 | ids=[ |
164 | 207 | 'regular', |
@@ -188,7 +231,7 @@ def test_compose_node_env( |
188 | 231 | with ( |
189 | 232 | mock.patch('node_cli.configs.user.validate_alias_or_address'), |
190 | 233 | mock.patch('node_cli.core.node.save_env_params'), |
191 | | - mock.patch('node_cli.core.node.get_flask_secret_key', return_value='mock_secret') |
| 234 | + mock.patch('node_cli.core.node.get_flask_secret_key', return_value='mock_secret'), |
192 | 235 | ): |
193 | 236 | result_env = compose_node_env( |
194 | 237 | env_filepath=user_config_path.as_posix(), |
@@ -274,6 +317,7 @@ def resource_file(): |
274 | 317 | if os.path.exists(RESOURCE_ALLOCATION_FILEPATH): |
275 | 318 | os.remove(RESOURCE_ALLOCATION_FILEPATH) |
276 | 319 |
|
| 320 | + |
277 | 321 | def test_init_node(regular_user_conf, no_resource_file): # todo: write new init node test |
278 | 322 | resp_mock = response_mock(requests.codes.created) |
279 | 323 | assert not os.path.isfile(RESOURCE_ALLOCATION_FILEPATH) |
@@ -318,7 +362,7 @@ def test_update_node(regular_user_conf, mocked_g_config, resource_file, inited_n |
318 | 362 | result = update( |
319 | 363 | regular_user_conf.as_posix(), |
320 | 364 | pull_config_for_schain=None, |
321 | | - node_type=NodeType.REGULAR |
| 365 | + node_type=NodeType.REGULAR, |
322 | 366 | ) |
323 | 367 | assert result is None |
324 | 368 |
|
|
0 commit comments