chia7712 commented on code in PR #20703:
URL: https://github.com/apache/kafka/pull/20703#discussion_r2449618258
##########
generator/src/test/java/org/apache/kafka/message/checker/MetadataSchemaCheckerToolTest.java:
##########
@@ -31,14 +31,24 @@
public class MetadataSchemaCheckerToolTest {
@Test
public void testVerifyEvolutionGit() throws Exception {
- try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) {
- Path rootKafkaDirectory = Paths.get("").toAbsolutePath();
- while (!Files.exists(rootKafkaDirectory.resolve(".git"))) {
- rootKafkaDirectory = rootKafkaDirectory.getParent();
- if (rootKafkaDirectory == null) {
- throw new RuntimeException("Invalid directory, need to be
within a Git repository");
- }
+ // Try to find the Git root directory
+ Path rootKafkaDirectory = Paths.get("").toAbsolutePath();
+ boolean gitFound = false;
+
+ while (rootKafkaDirectory != null) {
+ if (Files.exists(rootKafkaDirectory.resolve(".git"))) {
+ gitFound = true;
+ break;
}
+ rootKafkaDirectory = rootKafkaDirectory.getParent();
+ }
+
+ if (!gitFound) {
+ System.out.println("Skipping testVerifyEvolutionGit - not in a Git
repository");
+ return; // Skip test when running from source release without Git
Review Comment:
How about using `assumeTrue` instead?
--
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]