Closed rominf closed 6 months ago
Fedora package building fails because of flaky test:
________________ TestCompute.test_create_network_load_balancer _________________ self = <tests.test_compute.TestCompute object at 0x7f95a435f7d0> exo = <[AttributeError("'ExoscaleMock' object has no attribute 'api_key'") raised in repr()] ExoscaleMock object at 0x7f95a3398ef0> zone = {'id': '870666c8-f21f-4f1e-ae6f-bdd09d4a9a29', 'name': 'ch-gva-2'} nlb = <function nlb.<locals>._nlb at 0x7f95a37f45e0> def test_create_network_load_balancer(self, exo, zone, nlb): zone = zone() nlb_name = _random_str() nlb_description = _random_str() nlb_creation_date = datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ") operation_id = _random_uuid() expected = nlb( zone=zone["name"], name=nlb_name, description=nlb_description, created=nlb_creation_date, ) def _assert_request(request, context): body = json.loads(request.body) assert body["name"] == nlb_name assert body["description"] == nlb_description context.status_code = 200 context.headers["Content-Type"] = "application/json" return { "id": operation_id, "state": "success", "reference": {"id": expected["id"]}, } exo.mock_post(zone["name"], "load-balancer", _assert_request) exo.mock_get_operation(zone["name"], operation_id, expected["id"]) exo.mock_get_v2( zone["name"], "load-balancer/" + expected["id"], expected ) actual = exo.compute.create_network_load_balancer( zone=Zone._from_cs(zone), name=nlb_name, description=nlb_description, ) assert actual.zone.name == zone["name"] assert actual.name == expected["name"] assert actual.description == expected["description"] > assert ( actual.creation_date.strftime("%Y-%m-%dT%H:%M:%SZ") == nlb_creation_date ) E AssertionError: assert '2023-10-01T16:34:47Z' == '2023-10-01T16:34:46Z' E - 2023-10-01T16:34:46Z E ? ^ E + 2023-10-01T16:34:47Z E ? ^ tests/test_compute.py:864: AssertionError
I suggest to compare times using subtraction and comparing it to small timedelta.
I see API v1 bindings were dropped along with their tests in https://github.com/exoscale/python-exoscale/commit/7cf9609edfc43cf1a690bc3c97883c2baa2f4de2, so this is no longer actual. Closing.
Fedora package building fails because of flaky test:
I suggest to compare times using subtraction and comparing it to small timedelta.