- remove demo runner

- improve docs

- rename all tests to test_* (previously, also setup_* and cleanup_* existed) to improve stability as it is not guaranteed that pytest.ini is loaded.

- improve logging formatting

- improve full integration test

Reviewed-on: local-it-infrastructure/e2e_tests#18
Co-authored-by: Daniel <d.brummerloh@gmail.com>
Co-committed-by: Daniel <d.brummerloh@gmail.com>
This commit is contained in:
Daniel 2023-12-15 17:57:48 +01:00 committed by dan
parent 8b9dd47f9e
commit 0fafa22272
18 changed files with 58 additions and 81 deletions

View file

@ -1,3 +1,4 @@
import shutil
import subprocess
from pathlib import Path
@ -8,13 +9,25 @@ from pytest_abra.utils import load_json_to_environ
@pytest.fixture(scope="session")
def session_tmp_path_testout(tmp_path_factory: pytest.TempPathFactory) -> Path:
return tmp_path_factory.mktemp("test_out")
def tmp_recipes(tmp_path_factory: pytest.TempPathFactory) -> Path:
tmp_recipes_target = tmp_path_factory.mktemp("recipes")
recipes_dir_source = Path("recipes")
shutil.copytree(recipes_dir_source, tmp_recipes_target, dirs_exist_ok=True)
return tmp_recipes_target
@pytest.fixture(scope="session")
def tmp_output(tmp_path_factory: pytest.TempPathFactory) -> Path:
return tmp_path_factory.mktemp("output")
@pytest.mark.slow
def test_abratest_cli_full_integration(session_tmp_path_testout: Path):
"""run abratest against the dev instance"""
def test_abratest_cli_full_integration(tmp_output: Path, tmp_recipes: Path):
"""Full integration test of abratest against the dev instance. Recipes dir not in path
this test is hard to debug as the output dir is in tmp. If required, try
pytest -s
or find the tmp dir to look into test outputs"""
# --------------------- load credentials to env variables -------------------- #
@ -33,9 +46,9 @@ def test_abratest_cli_full_integration(session_tmp_path_testout: Path):
# ----------------------------------- dirs ----------------------------------- #
RECIPES_DIR = Path("./recipes").resolve()
# OUTPUT_DIR = Path("./test-output").resolve()
OUTPUT_DIR = session_tmp_path_testout.resolve()
RECIPES_DIR = tmp_recipes.resolve()
# RECIPES_DIR = Path("recipes")
OUTPUT_DIR = tmp_output.resolve()
# ------------------------------------ run ----------------------------------- #
@ -57,8 +70,8 @@ def test_abratest_cli_full_integration(session_tmp_path_testout: Path):
@pytest.mark.slow
def test_results_abra(session_tmp_path_testout: Path):
OUTPUT_DIR = session_tmp_path_testout.resolve()
def test_full_integration_results(tmp_output: Path):
OUTPUT_DIR = tmp_output.resolve()
DIR = DirManager(output_dir=OUTPUT_DIR, session_id="abc")
all_files = [f.name for f in DIR.STATUS.rglob("*")]