|
2 | 2 | import unittest |
3 | 3 | from unittest import mock |
4 | 4 |
|
5 | | -from easykube.rest.util import PropertyDict |
6 | | - |
7 | 5 | import freezegun |
8 | | - |
9 | 6 | import kopf |
| 7 | +from easykube.rest.util import PropertyDict |
10 | 8 |
|
11 | | -from ..models.v1alpha1 import lease as lease_crd |
12 | | -from .. import openstack, operator |
| 9 | +from azimuth_schedule_operator import openstack, operator |
| 10 | +from azimuth_schedule_operator.models.v1alpha1 import lease as lease_crd |
13 | 11 |
|
14 | 12 | from . import util |
15 | 13 |
|
16 | | - |
17 | 14 | API_VERSION = "scheduling.azimuth.stackhpc.com/v1alpha1" |
18 | 15 |
|
19 | 16 |
|
@@ -185,9 +182,9 @@ async def test_save_instance_status(self, k8s_client): |
185 | 182 | async def test_save_instance_status_conflict(self, k8s_client): |
186 | 183 | lease_data = fake_lease(phase=lease_crd.LeasePhase.PENDING) |
187 | 184 |
|
188 | | - k8s_client.apis[API_VERSION].resources["leases/status"].replace.side_effect = ( |
189 | | - util.k8s_api_error(409) |
190 | | - ) |
| 185 | + k8s_client.apis[API_VERSION].resources[ |
| 186 | + "leases/status" |
| 187 | + ].replace.side_effect = util.k8s_api_error(409) |
191 | 188 |
|
192 | 189 | lease = lease_crd.Lease.model_validate(lease_data) |
193 | 190 | with self.assertRaises(kopf.TemporaryError): |
@@ -351,15 +348,15 @@ def test_get_size_map(self): |
351 | 348 |
|
352 | 349 | async def test_get_size_name_map(self): |
353 | 350 | cloud = util.mock_openstack_cloud() |
354 | | - cloud.clients["compute"].resources["flavors"].list.return_value = ( |
355 | | - util.as_async_iterable( |
356 | | - [ |
357 | | - PropertyDict({"id": "id1", "name": "flavor1"}), |
358 | | - PropertyDict({"id": "id2", "name": "flavor2"}), |
359 | | - PropertyDict({"id": "newid1", "name": "newflavor1"}), |
360 | | - PropertyDict({"id": "newid2", "name": "newflavor2"}), |
361 | | - ] |
362 | | - ) |
| 351 | + cloud.clients["compute"].resources[ |
| 352 | + "flavors" |
| 353 | + ].list.return_value = util.as_async_iterable( |
| 354 | + [ |
| 355 | + PropertyDict({"id": "id1", "name": "flavor1"}), |
| 356 | + PropertyDict({"id": "id2", "name": "flavor2"}), |
| 357 | + PropertyDict({"id": "newid1", "name": "newflavor1"}), |
| 358 | + PropertyDict({"id": "newid2", "name": "newflavor2"}), |
| 359 | + ] |
363 | 360 | ) |
364 | 361 |
|
365 | 362 | size_map = {"id1": "newid1", "id2": "newid2", "id3": "newid3"} |
@@ -1290,9 +1287,9 @@ async def test_delete_lease_finalizer_present(self, k8s_client): |
1290 | 1287 | async def test_delete_lease_secret_already_deleted(self, k8s_client): |
1291 | 1288 | # Configure the Kubernetes client |
1292 | 1289 | self.k8s_client_config_common(k8s_client) |
1293 | | - k8s_client.apis["v1"].resources["secrets"].fetch.side_effect = ( |
1294 | | - util.k8s_api_error(404) |
1295 | | - ) |
| 1290 | + k8s_client.apis["v1"].resources[ |
| 1291 | + "secrets" |
| 1292 | + ].fetch.side_effect = util.k8s_api_error(404) |
1296 | 1293 |
|
1297 | 1294 | lease = fake_lease() |
1298 | 1295 | await operator.delete_lease(lease, mock.Mock()) |
|
0 commit comments