yandrey321 commented on code in PR #12114:
URL: https://github.com/apache/ozone/pull/12114#discussion_r4675296541
##########
hadoop-ozone/cli-repair/src/main/java/org/apache/hadoop/ozone/repair/scm/cert/RecoverSCMCertificate.java:
##########
@@ -149,12 +154,23 @@ private static X509Certificate getRootCertificate(
return cert.get();
}
+ /** This SCM's ID, or null if its storage cannot be read: then certificates
are only matched by host name. */
+ private String getScmId() {
Review Comment:
Added TestRecoverSCMCertificate. getSubCertificate and the root CA check,
now split out as isRootCA, are package-private @VisibleForTesting static
methods. The test runs them on real self-signed certificates:
- getSubCertificate:
- finds the sub-CA certificate by host name;
- finds it by scm-sub@<SCM ID> when the host name doesn't match;
- ignores another SCM's certificate;
- with no SCM ID (the fallback when SCMStorageConfig can't be read),
matches by host name only and fails for a long host name.
- isRootCA: the same cases for scm@<host> and scm@<SCM ID>, including a
different SCM ID.
The SCMStorageConfig read itself is still only covered by the compose
script. In the unit test, the fallback is the null SCM ID it produces.
--
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]