Skip to content

Commit 02cd155

Browse files
committed
docs: for determine_namespace
1 parent f62f8ae commit 02cd155

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/beku/kuttl.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,18 @@ def expand(
331331

332332

333333
def determine_namespace(testcase_name: str) -> str:
334+
"""Generate a namespace name for the given test case.
335+
336+
The format of the namespace name is "kuttl-<hash>" where hash is the first 10 chars of the test
337+
case's sha256 value.
338+
339+
There is an analogous function in "kubectl-kuttl" that generates the exact same namespace name.
340+
These two have to be kept in sync!
341+
342+
The tests use the namespace name also for other kubernetes objects like "metadata.name" which have
343+
different syntactic restrictions.
344+
Therefore, to be on the safe side, the namespace name is kept as simple as possible.
345+
"""
334346
hash = sha256(testcase_name.encode("utf-8")).hexdigest()
335347
return f"kuttl-{hash[:10]}"
336348

0 commit comments

Comments
 (0)