Skip to content

Commit 6b8f528

Browse files
committed
feat: add configurable Kerberos debug option
- Introduced a new `debug` configuration option for Kerberos. - Updated container setup to include `KERBY_DEBUG` environment variable. - Extended TOML and programmatic configurations to support `debug`. - Enhanced documentation with guidance on enabling debug mode for troubleshooting.
1 parent 14783b8 commit 6b8f528

7 files changed

Lines changed: 12 additions & 0 deletions

File tree

core/src/main/kotlin/org/openprojectx/bigdata/test/core/BigDataTestKitOptions.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ data class KerberosOptions(
2424
val materialTimeoutSeconds: Int = 30,
2525
val adminAttempts: Int = 30,
2626
val adminRetryDelaySeconds: Int = 1,
27+
val debug: Boolean = false,
2728
)
2829

2930
data class KerberosUserOptions(

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ internal class BigDataContainerFactory(
9494
.withEnv("KERBY_CLIENT_PASSWORD", kerberos.clientPassword)
9595
.withEnv("KERBY_KADMIN_ATTEMPTS", kerberos.adminAttempts.toString())
9696
.withEnv("KERBY_KADMIN_RETRY_DELAY_SECONDS", kerberos.adminRetryDelaySeconds.toString())
97+
.withEnv("KERBY_DEBUG", kerberos.debug.toString())
9798
.waitingFor(
9899
Wait.forLogMessage(".*Kerby KDC container ready\\..*", 1)
99100
.withStartupTimeout(Duration.ofSeconds(kerberos.startupTimeoutSeconds.toLong())),

doc/user-guide.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,10 +715,13 @@ startupTimeoutSeconds = 180
715715
materialTimeoutSeconds = 120
716716
adminAttempts = 120
717717
adminRetryDelaySeconds = 1
718+
debug = true
718719
----
719720

720721
`startupTimeoutSeconds` controls how long Testcontainers waits for the KDC image to print its ready log. `materialTimeoutSeconds` controls the post-start wait for generated keytabs and client config to be readable. `adminAttempts` and `adminRetryDelaySeconds` are passed to the Kerby image as `KERBY_KADMIN_ATTEMPTS` and `KERBY_KADMIN_RETRY_DELAY_SECONDS`.
721722

723+
Set `debug = true` when troubleshooting Kerberos startup in CI. It passes `KERBY_DEBUG=true` to the Kerby image, which enables JDK Kerberos debug output, Kerby DEBUG logs on container stdout, and dumps the generated `kdc.conf`, server `krb5.conf`, client `krb5.conf`, backend config, and admin server config into the container log.
724+
722725
Programmatic setup exposes the same options:
723726

724727
[source,kotlin]
@@ -730,6 +733,7 @@ BigDataTestKit.builder()
730733
startupTimeoutSeconds = 180,
731734
materialTimeoutSeconds = 120,
732735
adminAttempts = 120,
736+
debug = true,
733737
),
734738
)
735739
----

example/spark/src/test/resources/spark-bigdata-test-apache-hms-kerberos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ startupTimeoutSeconds = 180
88
materialTimeoutSeconds = 120
99
adminAttempts = 120
1010
adminRetryDelaySeconds = 1
11+
debug = true
1112

1213
[ports]
1314
kafka = 19092

example/spark/src/test/resources/spark-bigdata-test-cloudera-hms-kerberos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ startupTimeoutSeconds = 180
88
materialTimeoutSeconds = 120
99
adminAttempts = 120
1010
adminRetryDelaySeconds = 1
11+
debug = true
1112

1213
[ports]
1314
kafka = 19092

junit5/src/main/kotlin/org/openprojectx/bigdata/test/junit5/BigDataTestConfig.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ internal data class BigDataTestKerberosConfig(
4242
val materialTimeoutSeconds: Int? = null,
4343
val adminAttempts: Int? = null,
4444
val adminRetryDelaySeconds: Int? = null,
45+
val debug: Boolean? = null,
4546
) {
4647
fun merge(override: BigDataTestKerberosConfig): BigDataTestKerberosConfig =
4748
BigDataTestKerberosConfig(
4849
startupTimeoutSeconds = override.startupTimeoutSeconds ?: startupTimeoutSeconds,
4950
materialTimeoutSeconds = override.materialTimeoutSeconds ?: materialTimeoutSeconds,
5051
adminAttempts = override.adminAttempts ?: adminAttempts,
5152
adminRetryDelaySeconds = override.adminRetryDelaySeconds ?: adminRetryDelaySeconds,
53+
debug = override.debug ?: debug,
5254
)
5355
}
5456

@@ -249,6 +251,7 @@ internal class BigDataTestConfigLoader(
249251
materialTimeoutSeconds = kerberos.int("materialTimeoutSeconds"),
250252
adminAttempts = kerberos.int("adminAttempts"),
251253
adminRetryDelaySeconds = kerberos.int("adminRetryDelaySeconds"),
254+
debug = kerberos.boolean("debug"),
252255
),
253256
tls = BigDataTestTlsConfig(
254257
enabled = tls.boolean("enabled"),

junit5/src/main/kotlin/org/openprojectx/bigdata/test/junit5/BigDataTestExtension.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ class BigDataTestExtension : BeforeAllCallback, AfterAllCallback, ParameterResol
141141
materialTimeoutSeconds = kerberosConfig.materialTimeoutSeconds ?: defaultKerberos.materialTimeoutSeconds,
142142
adminAttempts = kerberosConfig.adminAttempts ?: defaultKerberos.adminAttempts,
143143
adminRetryDelaySeconds = kerberosConfig.adminRetryDelaySeconds ?: defaultKerberos.adminRetryDelaySeconds,
144+
debug = kerberosConfig.debug ?: defaultKerberos.debug,
144145
),
145146
)
146147
}

0 commit comments

Comments
 (0)