diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5cdf3f30..a875d0c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -190,6 +190,10 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.12" + - name: "Set environment variables" + run: | + RUNNER_NUM=$(hostname | grep -o '[0-9][0-9]' | sed 's/^0*//') + echo PYTEST_DEBUG_TEMPROOT=/var/lib/github/ghrunner_${RUNNER_NUM}/_temp >> $GITHUB_ENV - name: "Setup environment" run: | pipx install poetry==1.8.5 diff --git a/tests/integration/test_repository.py b/tests/integration/test_repository.py index 9de48b91..359f1e68 100644 --- a/tests/integration/test_repository.py +++ b/tests/integration/test_repository.py @@ -1,31 +1,31 @@ -# from __future__ import annotations +from __future__ import annotations -# from typing import TYPE_CHECKING +from typing import TYPE_CHECKING -# import pytest +import pytest -# from infrahub_sdk.testing.docker import TestInfrahubDockerClient -# from infrahub_sdk.testing.repository import GitRepo -# from infrahub_sdk.utils import get_fixtures_dir +from infrahub_sdk.testing.docker import TestInfrahubDockerClient +from infrahub_sdk.testing.repository import GitRepo +from infrahub_sdk.utils import get_fixtures_dir -# if TYPE_CHECKING: -# from infrahub_sdk import InfrahubClient +if TYPE_CHECKING: + from infrahub_sdk import InfrahubClient -# class TestInfrahubRepository(TestInfrahubDockerClient): -# @pytest.fixture(scope="class") -# def infrahub_version(self) -> str: -# return "1.1.0" +class TestInfrahubRepository(TestInfrahubDockerClient): + @pytest.fixture(scope="class") + def infrahub_version(self) -> str: + return "1.1.0" -# async def test_add_repository(self, client: InfrahubClient, remote_repos_dir): -# src_directory = get_fixtures_dir() / "integration/mock_repo" -# repo = GitRepo(name="mock_repo", src_directory=src_directory, dst_directory=remote_repos_dir) -# commit = repo._repo.git[repo._repo.git.head()] -# assert len(list(repo._repo.git.get_walker())) == 1 -# assert commit.message.decode("utf-8") == "First commit" + async def test_add_repository(self, client: InfrahubClient, remote_repos_dir): + src_directory = get_fixtures_dir() / "integration/mock_repo" + repo = GitRepo(name="mock_repo", src_directory=src_directory, dst_directory=remote_repos_dir) + commit = repo._repo.git[repo._repo.git.head()] + assert len(list(repo._repo.git.get_walker())) == 1 + assert commit.message.decode("utf-8") == "First commit" -# response = await repo.add_to_infrahub(client=client) -# assert response.get(f"{repo.type.value}Create", {}).get("ok") + response = await repo.add_to_infrahub(client=client) + assert response.get(f"{repo.type.value}Create", {}).get("ok") -# repos = await client.all(kind=repo.type) -# assert repos + repos = await client.all(kind=repo.type) + assert repos