Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 22 additions & 22 deletions tests/integration/test_repository.py
Original file line number Diff line number Diff line change
@@ -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
Loading