-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Closed
Copy link
Labels
type/bugSomething isn't working as expectedSomething isn't working as expected
Description
Component
Python SDK
Infrahub SDK version
1.13.3
Current Behavior
=================================== FAILURES ===================================
______________________ TestDemoflow.test_proposed_change _______________________
self = <integration.test_workflow.TestDemoflow object at 0x7549f6af21b0>
client_main = <infrahub_sdk.client.InfrahubClientSync object at 0x7549f6b5aab0>
default_branch = 'test-demo'
def test_proposed_change(self, client_main, default_branch):
pc_mutation_create = Mutation(
mutation="CoreProposedChangeCreate",
input_data={
"data": {
"name": {"value": "Test Merge PC"},
"source_branch": {"value": default_branch},
"destination_branch": {"value": "main"},
}
},
query={"ok": None, "object": {"id": None}},
)
response_pc = client_main.execute_graphql(query=pc_mutation_create.render())
pc_id = response_pc["CoreProposedChangeCreate"]["object"]["id"]
max_attempts = 15
attempts = 0
validation_results = []
validations_completed = False
while not validations_completed and attempts < max_attempts:
> pc = client_main.get(
"CoreProposedChange",
name__value="Test Merge PC",
include=["validations"],
exclude=["reviewers", "approved_by", "created_by"],
prefetch_relationships=True,
populate_store=True,
)
tests/integration/test_workflow.py:181:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/root/.cache/pypoetry/virtualenvs/infrahub-demo-dc-fabric-7VLWAmpj-py3.12/lib/python3.12/site-packages/infrahub_sdk/client.py:2191: in get
results = self.filters(
/root/.cache/pypoetry/virtualenvs/infrahub-demo-dc-fabric-7VLWAmpj-py3.12/lib/python3.12/site-packages/infrahub_sdk/client.py:2028: in filters
nodes, related_nodes = process_batch() if parallel else process_non_batch()
/root/.cache/pypoetry/virtualenvs/infrahub-demo-dc-fabric-7VLWAmpj-py3.12/lib/python3.12/site-packages/infrahub_sdk/client.py:2015: in process_non_batch
response, process_result = process_page(page_offset, page_number)
/root/.cache/pypoetry/virtualenvs/infrahub-demo-dc-fabric-7VLWAmpj-py3.12/lib/python3.12/site-packages/infrahub_sdk/client.py:1978: in process_page
process_result: ProcessRelationsNodeSync = self._process_nodes_and_relationships(
/root/.cache/pypoetry/virtualenvs/infrahub-demo-dc-fabric-7VLWAmpj-py3.12/lib/python3.12/site-packages/infrahub_sdk/client.py:1860: in _process_nodes_and_relationships
node._process_relationships(node_data=item, branch=branch, related_nodes=related_nodes, timeout=timeout)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = Test Merge PC
node_data = {'node': {'__typename': 'CoreProposedChange', 'description': {'value': None}, 'destination_branch': {'value': 'main'}, 'display_label': 'Test Merge PC', ...}}
branch = 'main', related_nodes = [], timeout = None
def _process_relationships(
self,
node_data: dict[str, Any],
branch: str,
related_nodes: list[InfrahubNodeSync],
timeout: int | None = None,
) -> None:
"""Processes the Relationships of a InfrahubNodeSync and add Related Nodes to a list.
Args:
node_data (dict[str, Any]): The item from the GraphQL response corresponding to the node.
branch (str): The branch name.
related_nodes (list[InfrahubNodeSync]): The list to which related nodes will be appended.
timeout (int, optional): Overrides default timeout used when querying the graphql API. Specified in seconds.
"""
for rel_name in self._relationships:
rel = getattr(self, rel_name)
if rel and isinstance(rel, RelatedNodeSync):
relation = node_data["node"].get(rel_name)
> if relation.get("node", None):
E AttributeError: 'NoneType' object has no attribute 'get'
/root/.cache/pypoetry/virtualenvs/infrahub-demo-dc-fabric-7VLWAmpj-py3.12/lib/python3.12/site-packages/infrahub_sdk/node/node.py:1[49](https://github.com/opsmill/infrahub-demo-dc-fabric/actions/runs/15980729178/job/45074278286#step:7:50)7: AttributeErro
Expected Behavior
Better handling during the processing
Steps to Reproduce
See tests in demo-dc-fabric
Additional Information
No response
Metadata
Metadata
Assignees
Labels
type/bugSomething isn't working as expectedSomething isn't working as expected