Skip to content

Commit

Permalink
Add --config-override option to goth tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kmazurek committed Apr 21, 2021
1 parent 0f39a43 commit 66b275c
Show file tree
Hide file tree
Showing 4 changed files with 239 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
poetry run poe goth-assets
poetry run poe goth-tests --yagna-binary-path=/tmp/yagna-build
poetry run poe goth-tests --config-override docker-compose.build-environment.binary-path=/tmp/yagna-build
- name: Upload test logs
uses: actions/upload-artifact@v2
Expand Down
22 changes: 22 additions & 0 deletions goth_tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
from datetime import datetime, timezone
from pathlib import Path
from typing import List, Optional

import pytest

from goth.configuration import Override
from goth.runner.log import configure_logging

def pytest_addoption(parser):
parser.addoption(
"--config-override",
action="append",
help="Set an override for a value specified in goth-config.yml file. \
This argument may be used multiple times. \
Values must follow the convention: {yaml_path}={value}, e.g.: \
`docker-compose.docker-dir=/tmp/some_dir",
)

@pytest.fixture(scope="session")
def common_assets() -> Path:
Expand All @@ -22,3 +33,14 @@ def log_dir() -> Path:
configure_logging(log_dir)

return log_dir

@pytest.fixture(scope="session")
def config_overrides(request) -> Optional[List[Override]]:
"""Fixture parsing --config-override params passed to the test invocation."""
overrides: Optional[List[str]] = request.config.option.config_override

if overrides:
tuples = [tuple(o.split("=")) for o in overrides]
return tuples

return None
7 changes: 4 additions & 3 deletions goth_tests/e2e/vm/test_e2e_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import logging
import os
from pathlib import Path
from typing import List
from typing import List, Optional

import pytest

from goth.address import (
PROXY_HOST,
YAGNA_REST_URL,
)
from goth.configuration import load_yaml
from goth.configuration import load_yaml, Override
from goth.node import node_environment
from goth.runner import Runner
from goth.runner.container.payment import PaymentIdPool
Expand All @@ -28,11 +28,12 @@
@pytest.mark.asyncio
async def test_e2e_vm_success(
common_assets: Path,
config_overrides: Optional[List[Override]],
log_dir: Path,
):
"""Test successful flow requesting a Blender task with goth REST API client."""

goth_config = load_yaml(common_assets / "goth-config.yml")
goth_config = load_yaml(common_assets / "goth-config.yml", config_overrides)

runner = Runner(
base_log_dir=log_dir,
Expand Down
Loading

0 comments on commit 66b275c

Please sign in to comment.