You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "iit2009060 (via GitHub)" <gi...@apache.org> on 2025/10/15 05:40:32 UTC
[PR] KAFKA-18973 gracefully stopping test execution if .git does not exist [kafka]
iit2009060 opened a new pull request, #20703:
URL: https://github.com/apache/kafka/pull/20703
Skipping test if .git not found.
Test cases
1. Running from Kafka root directory:
- Finds .git immediately
- Schema file found at correct path
- Test runs successfully
2. Running from subdirectories (like generator/ or generator/src/test/java/):
- Searches up directory tree
- Finds .git at Kafka root
- Uses root to build correct schema path
- Test runs successfully
3. Running from source release (no Git anywhere):
- Searches up entire directory tree to filesystem root
- Never finds .git
- Test skips gracefully with message
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18973 gracefully stopping test execution if .git does not exist [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18973 gracefully stopping test execution if .git does not exist [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 merged PR #20703:
URL: https://github.com/apache/kafka/pull/20703
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18973 gracefully stopping test execution if .git does not exist [kafka]
Posted by "iit2009060 (via GitHub)" <gi...@apache.org>.
iit2009060 commented on code in PR #20703:
URL: https://github.com/apache/kafka/pull/20703#discussion_r2450517674
##########
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:
Thanks that would be better. I have done the changes.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18973 gracefully stopping test execution if .git does not exist [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on PR #20703:
URL: https://github.com/apache/kafka/pull/20703#issuecomment-3432967473
the flaky is traced by KAFKA-19513
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18973 gracefully stopping test execution if .git does not exist [kafka]
Posted by "iit2009060 (via GitHub)" <gi...@apache.org>.
iit2009060 commented on PR #20703:
URL: https://github.com/apache/kafka/pull/20703#issuecomment-3404601417
@lianetm Please review it
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org