authentik setup and tracing (#2)

* authentik sessions created successfully during setup without breaking tracing

* setup works on EN and DE localization by using regex patterns

* automated tracing with pytest --trace option, manual hook no longer needed

Reviewed-on: local-it-infrastructure/e2e_tests#2
Co-authored-by: Daniel <d.brummerloh@gmail.com>
Co-committed-by: Daniel <d.brummerloh@gmail.com>
This commit is contained in:
Daniel 2023-11-27 17:01:45 +01:00 committed by dan
parent 97ed87c79f
commit d2cd6ba47f
22 changed files with 519 additions and 304 deletions

View file

@ -8,37 +8,49 @@ class DirManager:
The structures is as follows:
tests dir/
session_dir-1/
progress
records
states
results
states
session_dir-2/
records
...
"""
def __init__(self, tests_dir: Path, session_id: str):
def __init__(self, output_dir: Path | str, session_id: str):
# root test dir
self.tests_dir = tests_dir
if isinstance(output_dir, str):
output_dir = Path(output_dir)
self._output_dir = output_dir.resolve()
self.session_id = session_id
self.dirs = self._get_all_dirs()
def create_all_dirs(self):
self.create_dirs(self.tests_dir, exist_ok=True)
self.create_dirs(self.dirs)
self.create_dirs(self._output_dir, exist_ok=True)
self.create_dirs([self.SESSION, self.RECORDS, self.STATES, self.RESULTS, self.PROGRESS], exist_ok=True)
def _get_all_dirs(self):
dirs = {}
dirs["session"] = self.tests_dir / f"test-{self.session_id}"
dirs.update(self._get_subdirs(session_dir=dirs["session"]))
return dirs
@property
def OUTPUT(self):
return self._output_dir
def _get_subdirs(self, session_dir: Path):
return {
"records": session_dir / Path("records"),
"states": session_dir / Path("states"),
"results": session_dir / Path("results"),
}
@property
def SESSION(self):
return self._output_dir / f"test-{self.session_id}"
@property
def RECORDS(self):
return self.SESSION / Path("records")
@property
def STATES(self):
return self.SESSION / Path("states")
@property
def RESULTS(self):
return self.SESSION / Path("results")
@property
def PROGRESS(self):
return self.SESSION / Path("progress")
@staticmethod
def create_dirs(dirs: Path | list[Path] | dict[str, Path], exist_ok=False):