rename runner.name to runner.env_type
This commit is contained in:
parent
e415b8a16a
commit
a6c7a18e7b
7 changed files with 10 additions and 10 deletions
|
|
@ -104,5 +104,5 @@ class Coordinator:
|
||||||
assert len(runner_class_names) == 1
|
assert len(runner_class_names) == 1
|
||||||
runner_class_name = runner_class_names[0]
|
runner_class_name = runner_class_names[0]
|
||||||
RunnerClass: type[Runner] = getattr(module, runner_class_name)
|
RunnerClass: type[Runner] = getattr(module, runner_class_name)
|
||||||
RUNNER_DICT[RunnerClass.name] = RunnerClass
|
RUNNER_DICT[RunnerClass.env_type] = RunnerClass
|
||||||
return RUNNER_DICT
|
return RUNNER_DICT
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class EnvManager:
|
||||||
for env_file in env_files:
|
for env_file in env_files:
|
||||||
child_runner_class = RUNNER_DICT[env_file.env_type]
|
child_runner_class = RUNNER_DICT[env_file.env_type]
|
||||||
for dependency in child_runner_class.dependencies:
|
for dependency in child_runner_class.dependencies:
|
||||||
dependency_rule = DependencyRule(child=child_runner_class.name, dependency=dependency)
|
dependency_rule = DependencyRule(child=child_runner_class.env_type, dependency=dependency)
|
||||||
dependency_rules.append(dependency_rule)
|
dependency_rules.append(dependency_rule)
|
||||||
return dependency_rules
|
return dependency_rules
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class Test:
|
||||||
|
|
||||||
|
|
||||||
class Runner:
|
class Runner:
|
||||||
name: str = ""
|
env_type: str = ""
|
||||||
setups: list[Test] = []
|
setups: list[Test] = []
|
||||||
tests: list[Test] = []
|
tests: list[Test] = []
|
||||||
cleanups: list[Test] = []
|
cleanups: list[Test] = []
|
||||||
|
|
@ -54,7 +54,7 @@ class Runner:
|
||||||
"""runs the main test script and if available and sub test scripts if their running condition is met"""
|
"""runs the main test script and if available and sub test scripts if their running condition is met"""
|
||||||
# check if required dependencies have passed
|
# check if required dependencies have passed
|
||||||
if not self._dependencies_passed():
|
if not self._dependencies_passed():
|
||||||
logger.warning(f"skipping run_tests() of {self.name}, because some dependencies have not passed")
|
logger.warning(f"skipping run_tests() of {self.env_type}, because some dependencies have not passed")
|
||||||
return
|
return
|
||||||
|
|
||||||
for test in test_list:
|
for test in test_list:
|
||||||
|
|
@ -67,7 +67,7 @@ class Runner:
|
||||||
# condition_available: true / pass
|
# condition_available: true / pass
|
||||||
# condition_met: true / false
|
# condition_met: true / false
|
||||||
|
|
||||||
identifier_string = self.combine_names(self.name, test.test_file)
|
identifier_string = self.combine_names(self.env_type, test.test_file)
|
||||||
|
|
||||||
results = list(self.DIR.RECIPES.rglob(test.test_file))
|
results = list(self.DIR.RECIPES.rglob(test.test_file))
|
||||||
assert len(results) == 1, f"{test.test_file} should exist exactly 1 time, but found {len(results)} times"
|
assert len(results) == 1, f"{test.test_file} should exist exactly 1 time, but found {len(results)} times"
|
||||||
|
|
@ -177,7 +177,7 @@ class Runner:
|
||||||
results = []
|
results = []
|
||||||
for dependency_runner in self._dependency_runners:
|
for dependency_runner in self._dependency_runners:
|
||||||
for setup_name in dependency_runner.setups:
|
for setup_name in dependency_runner.setups:
|
||||||
dependencie_identifier = self.combine_names(dependency_runner.name, setup_name.test_file)
|
dependencie_identifier = self.combine_names(dependency_runner.env_type, setup_name.test_file)
|
||||||
results.append(any(dependencie_identifier in f for f in passed_tests))
|
results.append(any(dependencie_identifier in f for f in passed_tests))
|
||||||
return all(results)
|
return all(results)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,6 @@ def condition_always_false(dotenv_config: dict[str, str]) -> bool:
|
||||||
|
|
||||||
|
|
||||||
class RunnerAuthentik(Runner):
|
class RunnerAuthentik(Runner):
|
||||||
name = "authentik"
|
env_type = "authentik"
|
||||||
setups = [Test(test_file="setup_authentik.py")]
|
setups = [Test(test_file="setup_authentik.py")]
|
||||||
# tests = [Test(test_file="test_authentik_dummy.py")]
|
# tests = [Test(test_file="test_authentik_dummy.py")]
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from abratest.runner import Runner, Test
|
||||||
class RunnerDemo(Runner):
|
class RunnerDemo(Runner):
|
||||||
"""Every env file has a corresponding runner class"""
|
"""Every env file has a corresponding runner class"""
|
||||||
|
|
||||||
name: str = "demo" # name of the test, used for logging / output naming
|
env_type = "demo" # name of the test, used for logging / output naming
|
||||||
|
|
||||||
# this indicates that tests from RunnerDemo depend on the setup from RunnerAuthentik.
|
# this indicates that tests from RunnerDemo depend on the setup from RunnerAuthentik.
|
||||||
# RunnerDemo will only execute, when setup_authentik.py has finished successfully.
|
# RunnerDemo will only execute, when setup_authentik.py has finished successfully.
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ def condition_always_false(dotenv_config: dict[str, str]) -> bool:
|
||||||
|
|
||||||
|
|
||||||
class RunnerNextcloud(Runner):
|
class RunnerNextcloud(Runner):
|
||||||
name: str = "nextcloud"
|
env_type = "nextcloud"
|
||||||
dependencies = ["authentik"]
|
dependencies = ["authentik"]
|
||||||
setups = [Test(test_file="setup_nextcloud.py", prevent_skip=False)]
|
setups = [Test(test_file="setup_nextcloud.py", prevent_skip=False)]
|
||||||
tests = [
|
tests = [
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ def condition_has_locale(dotenv_config: dict[str, str]) -> bool:
|
||||||
|
|
||||||
|
|
||||||
class RunnerWordpress(Runner):
|
class RunnerWordpress(Runner):
|
||||||
name = "wordpress"
|
env_type = "wordpress"
|
||||||
dependencies = ["authentik"]
|
dependencies = ["authentik"]
|
||||||
setups = [Test(test_file="setup_wordpress.py")]
|
setups = [Test(test_file="setup_wordpress.py")]
|
||||||
tests = [
|
tests = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue