Copilot commented on code in PR #11464:
URL: https://github.com/apache/ozone/pull/11464#discussion_r4237789804
##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/TestS3GatewayHttpServers.java:
##########
@@ -46,6 +54,23 @@ class TestS3GatewayHttpServers {
@TempDir
private Path tempDir;
+ /**
+ * Switching {@link UserGroupInformation} to Kerberos reads the default
+ * realm, which the JDK resolves from these properties when there is no
+ * krb5.conf, as in CI.
+ */
+ @BeforeAll
+ static void fakeKerberosRealm() {
+ System.setProperty("java.security.krb5.realm", "EXAMPLE.COM");
+ System.setProperty("java.security.krb5.kdc", "localhost");
+ }
+
+ @AfterAll
+ static void clearKerberosRealm() {
+ System.clearProperty("java.security.krb5.realm");
+ System.clearProperty("java.security.krb5.kdc");
+ }
Review Comment:
These methods mutate JVM-wide Kerberos system properties and then
unconditionally clear them. If the test JVM already supplied a
`java.security.krb5.realm` or `java.security.krb5.kdc` (or another test changes
them concurrently), this class destroys that state and can make later Kerberos
tests observe the wrong realm/KDC. Capture the previous values in `@BeforeAll`
and restore them in `@AfterAll` instead of always clearing them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]