Skip to content

Commit efcf472

Browse files
authored
Add variable to fix repository issue from ci (#234)
1 parent 5d28576 commit efcf472

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ jobs:
190190
uses: actions/setup-python@v5
191191
with:
192192
python-version: "3.12"
193+
- name: "Set environment variables"
194+
run: |
195+
RUNNER_NUM=$(hostname | grep -o '[0-9][0-9]' | sed 's/^0*//')
196+
echo PYTEST_DEBUG_TEMPROOT=/var/lib/github/ghrunner_${RUNNER_NUM}/_temp >> $GITHUB_ENV
193197
- name: "Setup environment"
194198
run: |
195199
pipx install poetry==1.8.5
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
# from __future__ import annotations
1+
from __future__ import annotations
22

3-
# from typing import TYPE_CHECKING
3+
from typing import TYPE_CHECKING
44

5-
# import pytest
5+
import pytest
66

7-
# from infrahub_sdk.testing.docker import TestInfrahubDockerClient
8-
# from infrahub_sdk.testing.repository import GitRepo
9-
# from infrahub_sdk.utils import get_fixtures_dir
7+
from infrahub_sdk.testing.docker import TestInfrahubDockerClient
8+
from infrahub_sdk.testing.repository import GitRepo
9+
from infrahub_sdk.utils import get_fixtures_dir
1010

11-
# if TYPE_CHECKING:
12-
# from infrahub_sdk import InfrahubClient
11+
if TYPE_CHECKING:
12+
from infrahub_sdk import InfrahubClient
1313

1414

15-
# class TestInfrahubRepository(TestInfrahubDockerClient):
16-
# @pytest.fixture(scope="class")
17-
# def infrahub_version(self) -> str:
18-
# return "1.1.0"
15+
class TestInfrahubRepository(TestInfrahubDockerClient):
16+
@pytest.fixture(scope="class")
17+
def infrahub_version(self) -> str:
18+
return "1.1.0"
1919

20-
# async def test_add_repository(self, client: InfrahubClient, remote_repos_dir):
21-
# src_directory = get_fixtures_dir() / "integration/mock_repo"
22-
# repo = GitRepo(name="mock_repo", src_directory=src_directory, dst_directory=remote_repos_dir)
23-
# commit = repo._repo.git[repo._repo.git.head()]
24-
# assert len(list(repo._repo.git.get_walker())) == 1
25-
# assert commit.message.decode("utf-8") == "First commit"
20+
async def test_add_repository(self, client: InfrahubClient, remote_repos_dir):
21+
src_directory = get_fixtures_dir() / "integration/mock_repo"
22+
repo = GitRepo(name="mock_repo", src_directory=src_directory, dst_directory=remote_repos_dir)
23+
commit = repo._repo.git[repo._repo.git.head()]
24+
assert len(list(repo._repo.git.get_walker())) == 1
25+
assert commit.message.decode("utf-8") == "First commit"
2626

27-
# response = await repo.add_to_infrahub(client=client)
28-
# assert response.get(f"{repo.type.value}Create", {}).get("ok")
27+
response = await repo.add_to_infrahub(client=client)
28+
assert response.get(f"{repo.type.value}Create", {}).get("ok")
2929

30-
# repos = await client.all(kind=repo.type)
31-
# assert repos
30+
repos = await client.all(kind=repo.type)
31+
assert repos

0 commit comments

Comments
 (0)