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
70 changes: 63 additions & 7 deletions .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,66 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install .
test:
test-unit:
runs-on: ubuntu-latest
needs: build-server
defaults:
run:
working-directory: server
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install '.[test]'
python -m pip install .
- name: Test unit tests
run: |
set -o pipefail
pytest tests/unit -v 2>&1 | tee pytest-unit.log
- name: Upload test log
if: always()
uses: actions/upload-artifact@v4
with:
name: pytest-unit-log
path: server/pytest-unit.log
retention-days: 14

test-integration:
runs-on: ubuntu-latest
needs: build-server
defaults:
run:
working-directory: server
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install '.[test]'
python -m pip install .
- name: Test integration tests
run: |
set -o pipefail
pytest tests/integration -v 2>&1 | tee pytest-integration.log
- name: Upload test log
if: always()
uses: actions/upload-artifact@v4
with:
name: pytest-integration-log
path: server/pytest-integration.log
retention-days: 14

test-container:
runs-on: ubuntu-latest
strategy:
fail-fast: false
needs: build-server
defaults:
run:
Expand All @@ -62,14 +118,14 @@ jobs:
python -m pip install --upgrade pip
python -m pip install '.[test]'
python -m pip install .
- name: Test with pytest
- name: Test container tests
run: |
set -o pipefail
pytest -v 2>&1 | tee pytest-output.log
pytest tests/container -v 2>&1 | tee pytest-container.log
- name: Upload test log
if: always()
uses: actions/upload-artifact@v4
with:
name: pytest-log
path: server/pytest-output.log
name: pytest-container-log
path: server/pytest-container.log
retention-days: 14
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ venv

## caches
.*_cache
*.cache

# ides
.vscode
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from docker import DockerClient

SERVER_DIR = Path(__file__).parent.parent
SERVER_DIR = Path(__file__).parent.parent.parent


@pytest.fixture(scope="session")
Expand Down
Empty file.
File renamed without changes.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@


def test_compose(compose_file: Path) -> DockerCompose:
current_path = Path(__file__).parent.resolve()
current_path = Path(__file__).parent.parent.parent.resolve() # Navigate to server/ root

return DockerCompose(
str(current_path.parent.resolve()),
compose_file_name=str(current_path.parent.joinpath(compose_file).resolve()),
str(current_path),
compose_file_name=str(current_path / compose_file),
build=True,
)

Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: test-bash-ioc
include:
- ../../docker/cf-compose.yml
- ../../../../docker/cf-compose.yml
services:
recc1:
extends:
file: ../../compose.yml
file: ../../../../compose.yml
service: recc
depends_on:
cf:
Expand All @@ -16,7 +16,7 @@ services:
- net-2-cf
ioc1-1:
extends:
file: ../../../client/ioc-compose.yml
file: ../../../../../client/ioc-compose.yml
service: ioc1
environment:
- IOCSH_NAME=IOC1-1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: test-multi-recc
include:
- ../../docker/cf-compose.yml
- ../../../../docker/cf-compose.yml
services:
recc1:
extends:
file: ../../compose.yml
file: ../../../../compose.yml
service: recc
depends_on:
cf:
Expand All @@ -16,7 +16,7 @@ services:
- net-2-cf
ioc1-1:
extends:
file: ../../../client/ioc-compose.yml
file: ../../../../../client/ioc-compose.yml
service: ioc1
depends_on:
recc1:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: test-single-ioc
include:
- ../../docker/cf-compose.yml
- ../../../../docker/cf-compose.yml
services:
recc1:
extends:
file: ../../compose.yml
file: ../../../../compose.yml
service: recc
depends_on:
cf:
Expand All @@ -16,7 +16,7 @@ services:
- net-2-cf
ioc1-1:
extends:
file: ../../../client/ioc-compose.yml
file: ../../../../../client/ioc-compose.yml
service: ioc1
depends_on:
recc1:
Expand Down
Empty file.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

from docker import DockerClient

from .client_checks import (
from .cf_client import (
BASE_IOC_CHANNEL_COUNT,
DEFAULT_CHANNEL_NAME,
INACTIVE_PROPERTY,
check_channel_property,
create_client_and_wait,
wait_for_sync,
)
from .docker import ComposeFixtureFactory
from .docker_compose import ComposeFixtureFactory

LOG: logging.Logger = logging.getLogger(__name__)

Expand All @@ -27,7 +27,9 @@
encoding="utf-8",
)

setup_compose = ComposeFixtureFactory(Path("tests") / "docker" / "test-bash-ioc.yml").return_fixture()
setup_compose = ComposeFixtureFactory(
Path("tests/integration/resources/docker-compose/test-bash-ioc.yml")
).return_fixture()


def docker_exec_new_command(container: Container, command: str, env: Optional[dict] = None) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from channelfinder import ChannelFinderClient
from testcontainers.compose import DockerCompose

from .client_checks import BASE_ALIAS_COUNT, BASE_IOC_CHANNEL_COUNT, DEFAULT_CHANNEL_NAME, create_client_and_wait
from .docker import ComposeFixtureFactory
from .cf_client import BASE_ALIAS_COUNT, BASE_IOC_CHANNEL_COUNT, DEFAULT_CHANNEL_NAME, create_client_and_wait
from .docker_compose import ComposeFixtureFactory

LOG: logging.Logger = logging.getLogger(__name__)

Expand All @@ -15,7 +15,9 @@
IOC_COUNT = 4
EXPECTED_DEFAULT_CHANNEL_COUNT = IOC_COUNT * BASE_IOC_CHANNEL_COUNT

setup_compose = ComposeFixtureFactory(Path("tests") / "docker" / "test-multi-recc.yml").return_fixture()
setup_compose = ComposeFixtureFactory(
Path("tests/integration/resources/docker-compose/test-multi-recc.yml")
).return_fixture()


@pytest.fixture(scope="class")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from channelfinder import ChannelFinderClient
from testcontainers.compose import DockerCompose

from .client_checks import (
from .cf_client import (
BASE_IOC_CHANNEL_COUNT,
DEFAULT_CHANNEL_NAME,
INACTIVE_PROPERTY,
Expand All @@ -16,7 +16,7 @@
create_client_from_compose,
wait_for_sync,
)
from .docker import (
from .docker_compose import (
ComposeFixtureFactory,
clone_container,
restart_container,
Expand All @@ -28,7 +28,9 @@

LOG: logging.Logger = logging.getLogger(__name__)

setup_compose = ComposeFixtureFactory(Path("tests") / "docker" / "test-single-ioc.yml").return_fixture()
setup_compose = ComposeFixtureFactory(
Path("tests/integration/resources/docker-compose/test-single-ioc.yml")
).return_fixture()


@pytest.fixture(scope="class")
Expand Down
Empty file added server/tests/unit/__init__.py
Empty file.
Empty file added server/tests/unit/conftest.py
Empty file.
File renamed without changes.
File renamed without changes.
Loading