Skip to content

Commit 96e4fe1

Browse files
committed
fix: handle KDC container stoppage during keytab file generation
- Added checks to detect and handle unexpected KDC container stoppage while awaiting keytab generation. - Improved error messages to include container logs for better debugging.
1 parent 225115c commit 96e4fe1

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

core/src/main/kotlin/org/openprojectx/bigdata/test/core/container/BigDataContainerFactory.kt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,8 +918,24 @@ internal class BigDataContainerFactory(
918918
val sources = containerPaths.map { it.replace("/kerby/", "/var/lib/kerby/") }
919919
val deadline = System.nanoTime() + Duration.ofSeconds(30).toNanos()
920920
while (true) {
921+
if (!container.isRunning) {
922+
error(
923+
"Kerberos KDC stopped before generating expected keytab files: " +
924+
"${sources.joinToString(", ")}\n${container.logs}",
925+
)
926+
}
921927
val missing = sources.filterNot { source ->
922-
container.execInContainer("sh", "-lc", "test -s '$source'").exitCode == 0
928+
try {
929+
container.execInContainer("sh", "-lc", "test -s '$source'").exitCode == 0
930+
} catch (e: RuntimeException) {
931+
if (!container.isRunning) {
932+
error(
933+
"Kerberos KDC stopped before generating expected keytab files: " +
934+
"${sources.joinToString(", ")}\n${container.logs}",
935+
)
936+
}
937+
throw e
938+
}
923939
}
924940
if (missing.isEmpty()) return
925941
if (System.nanoTime() >= deadline) {

0 commit comments

Comments
 (0)