diff --git a/changelog/+nodes-order.added.md b/changelog/+nodes-order.added.md new file mode 100644 index 0000000..957690e --- /dev/null +++ b/changelog/+nodes-order.added.md @@ -0,0 +1 @@ +`client.all` and `client.filters` now support `order` parameter allowing to disable order of retrieve nodes in order to enhance performances diff --git a/tests/integration/test_infrahub_client.py b/tests/integration/test_infrahub_client.py index 3e9ab59..c18bc5f 100644 --- a/tests/integration/test_infrahub_client.py +++ b/tests/integration/test_infrahub_client.py @@ -10,7 +10,6 @@ from infrahub_sdk.schema import ProfileSchemaAPI from infrahub_sdk.testing.docker import TestInfrahubDockerClient from infrahub_sdk.testing.schemas.animal import TESTING_ANIMAL, TESTING_CAT, TESTING_DOG, TESTING_PERSON, SchemaAnimal -from infrahub_sdk.types import Order if TYPE_CHECKING: from infrahub_sdk import InfrahubClient @@ -62,17 +61,20 @@ async def test_get_all(self, client: InfrahubClient, base_dataset): assert isinstance(nodes[0], InfrahubNode) assert [node.name.value for node in nodes] == ["Bella", "Luna"] - async def test_get_all_no_order(self, client: InfrahubClient, base_dataset): - nodes = await client.all(kind=TESTING_CAT, order=Order(disable=True)) - assert len(nodes) == 2 - assert isinstance(nodes[0], InfrahubNode) - assert {node.name.value for node in nodes} == {"Bella", "Luna"} - - async def test_get_filters_no_order(self, client: InfrahubClient, base_dataset): - nodes = await client.filters(kind=TESTING_CAT, order=Order(disable=True)) - assert len(nodes) == 2 - assert isinstance(nodes[0], InfrahubNode) - assert {node.name.value for node in nodes} == {"Bella", "Luna"} + # TODO enable these tests for infrahub version containing this commit + # https://github.com/opsmill/infrahub/commit/5a4d6860196b5bfb51fb8a124f33125f4a0b6753 + # when we support testing against multiple infrahub versions. + # async def test_get_all_no_order(self, client: InfrahubClient, base_dataset): + # nodes = await client.all(kind=TESTING_CAT, order=Order(disable=True)) + # assert len(nodes) == 2 + # assert isinstance(nodes[0], InfrahubNode) + # assert {node.name.value for node in nodes} == {"Bella", "Luna"} + # + # async def test_get_filters_no_order(self, client: InfrahubClient, base_dataset): + # nodes = await client.filters(kind=TESTING_CAT, order=Order(disable=True)) + # assert len(nodes) == 2 + # assert isinstance(nodes[0], InfrahubNode) + # assert {node.name.value for node in nodes} == {"Bella", "Luna"} async def test_get_one(self, client: InfrahubClient, base_dataset, cat_luna, person_sophia): node1 = await client.get(kind=TESTING_CAT, id=cat_luna.id)