* refactoring and rework: runner now has setups / tests / cleanups as lists * add nextcloud runner * add email testing prototype with imap fixture * add dependency resolution (sort env files in input so that test order is correct) Reviewed-on: local-it-infrastructure/e2e_tests#5 Co-authored-by: Daniel <d.brummerloh@gmail.com> Co-committed-by: Daniel <d.brummerloh@gmail.com>
59 lines
1.5 KiB
Python
59 lines
1.5 KiB
Python
import sys
|
|
from pathlib import Path
|
|
|
|
from icecream import ic
|
|
|
|
sys.path.append(Path(__file__).parent.parent.resolve().__str__())
|
|
|
|
# import pytest
|
|
|
|
# from prototyping.sorting_algo import Rule, is_rule_satisfied, sort_by_rules
|
|
from src.coordinator import Coordinator
|
|
from src.env_file_helper import DependencyRule, EnvFile, sort_env_files_by_rule
|
|
|
|
# @pytest.fixture
|
|
# def in_list():
|
|
# return ["a", "b", "c", "d", "e", "f", "g"]
|
|
|
|
|
|
# @pytest.fixture
|
|
# def rules() -> list[Rule]:
|
|
# return [ # X depends on Y
|
|
# Rule("a", "e"),
|
|
# Rule("b", "e"),
|
|
# Rule("b", "f"),
|
|
# Rule("c", "e"),
|
|
# Rule("d", "e"),
|
|
# Rule("f", "e"),
|
|
# ]
|
|
|
|
|
|
# def has_rules_satisfied(in_list, rules):
|
|
# rule_satisfied: list[bool] = []
|
|
# for rule in rules:
|
|
# if is_rule_satisfied(in_list, rule):
|
|
# rule_satisfied.append(True)
|
|
# else:
|
|
# rule_satisfied.append(False)
|
|
# return all(rule_satisfied)
|
|
|
|
|
|
# def test_stuff(in_list, rules):
|
|
# sort_by_rules(in_list, rules)
|
|
# assert has_unique_elements(in_list)
|
|
# assert has_rules_satisfied(in_list, rules)
|
|
|
|
|
|
ENV_FILES = [
|
|
Path("envfiles/blog.test.dev.local-it.cloud.env"), # wordpress
|
|
Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik
|
|
]
|
|
|
|
|
|
env_files: list[EnvFile] = Coordinator._getn_env_files_list(ENV_FILES)
|
|
dependency_rules: list[DependencyRule] = Coordinator._get_dependency_rules(env_files)
|
|
|
|
ic(env_files)
|
|
sorted_env_files = sort_env_files_by_rule(env_files, dependency_rules)
|
|
ic(env_files)
|
|
ic(sorted_env_files)
|