Skip to content

Commit bd44e63

Browse files
committed
Run tests on infrahub 1.1, fix issue with branch async
1 parent c1fc2ef commit bd44e63

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

infrahub_sdk/branch.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class BranchData(BaseModel):
4040

4141

4242
MUTATION_QUERY_DATA = {"ok": None, "object": BRANCH_DATA}
43+
MUTATION_QUERY_TASK = {"ok": None, "task": {"id": None}}
4344

4445
QUERY_ALL_BRANCHES_DATA = {"Branch": BRANCH_DATA}
4546

@@ -119,13 +120,14 @@ async def create(
119120
},
120121
}
121122

122-
query = Mutation(mutation="BranchCreate", input_data=input_data, query=MUTATION_QUERY_DATA)
123+
mutation_query = MUTATION_QUERY_TASK if background_execution else MUTATION_QUERY_DATA
124+
query = Mutation(mutation="BranchCreate", input_data=input_data, query=mutation_query)
123125
response = await self.client.execute_graphql(query=query.render(), tracker="mutation-branch-create")
124126

125127
# Make sure server version is recent enough to support background execution, as previously
126128
# using background_execution=True had no effect.
127129
if background_execution and "task" in response["BranchCreate"]:
128-
return BranchData(**response["BranchCreate"]["task"]["id"])
130+
return response["BranchCreate"]["task"]["id"]
129131
return BranchData(**response["BranchCreate"]["object"])
130132

131133
async def delete(self, branch_name: str) -> bool:

tests/integration/test_infrahub_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class TestInfrahubNode(TestInfrahubDockerClient, SchemaAnimal):
1919
@pytest.fixture(scope="class")
2020
def infrahub_version(self) -> str:
21-
return "1.0.10"
21+
return "1.1.0"
2222

2323
@pytest.fixture(scope="class")
2424
async def base_dataset(

tests/integration/test_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class TestInfrahubNode(TestInfrahubDockerClient, SchemaCarPerson):
1414
@pytest.fixture(scope="class")
1515
def infrahub_version(self) -> str:
16-
return "1.0.10"
16+
return "1.1.0"
1717

1818
@pytest.fixture(scope="class")
1919
async def initial_schema(self, default_branch: str, client: InfrahubClient, schema_base: SchemaRoot) -> None:

0 commit comments

Comments
 (0)