Re: [PR] KAFKA-16413: add FileLockTest [kafka]

2024-04-03 Thread via GitHub


chia7712 merged PR #15624:
URL: https://github.com/apache/kafka/pull/15624


-- 
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-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-16413: add FileLockTest [kafka]

2024-04-03 Thread via GitHub


chia7712 commented on PR #15624:
URL: https://github.com/apache/kafka/pull/15624#issuecomment-2034576975

   ```
   ./gradlew cleanTest :tools:test --tests 
MetadataQuorumCommandTest.testDescribeQuorumReplicationSuccessful --tests 
JmxToolTest.initializationError :connect:runtime:test --tests 
org.apache.kafka.connect.integration.OffsetsApiIntegrationTest.testAlterSinkConnectorOffsetsOverriddenConsumerGroupId
 :trogdor:test --tests CoordinatorTest.testTaskRequestWithOldStartMsGetsUpdated 
:connect:mirror:test --tests 
IdentityReplicationIntegrationTest.testReplicateFromLatest --tests 
MirrorConnectorsIntegrationBaseTest.testSyncTopicConfigs --tests 
MirrorConnectorsIntegrationSSLTest.testReplicateSourceDefault --tests 
MirrorConnectorsWithCustomForwardingAdminIntegrationTest.testSyncTopicConfigs 
:core:test --tests 
DelegationTokenEndToEndAuthorizationWithOwnerTest.testCreateTokenForOtherUserFails
 --tests ConsumerBounceTest.testConsumptionWithBrokerFailures --tests 
ZkMigrationIntegrationTest.testMigrateTopicDeletions --tests 
UserQuotaTest.testQuotaOverrideDelete --tests 
SocketServerTest.testControlPlaneTa
 kePrecedenceOverInterBrokerListenerAsPrivilegedListener --tests 
SocketServerTest.testZeroMaxConnectionsPerIp --tests 
SocketServerTest.testStagedListenerShutdownWhenConnectionQueueIsFull --tests 
SocketServerTest.testStagedListenerStartup --tests 
SocketServerTest.testControlPlaneAsPrivilegedListener --tests 
SocketServerTest.testInterBrokerListenerAsPrivilegedListener --tests 
LogDirFailureTest.testIOExceptionDuringLogRoll --tests 
LogDirFailureTest.testIOExceptionDuringCheckpoint :clients:test --tests 
SelectorTest.testConnectionsByClientMetric --tests 
Tls12SelectorTest.testConnectionsByClientMetric --tests 
SelectorTest.testInboundConnectionsCountInConnectionCreationMetric --tests 
Tls12SelectorTest.testInboundConnectionsCountInConnectionCreationMetric --tests 
SelectorTest.testMuteOnOOM --tests Tls12SelectorTest.testMuteOnOOM --tests 
Tls13SelectorTest.testConnectionsByClientMetric --tests 
Tls13SelectorTest.testInboundConnectionsCountInConnectionCreationMetric --tests 
Tls13SelectorTest.tes
 tMuteOnOOM
   ```
   they pass on my local.


-- 
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-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-16413: add FileLockTest [kafka]

2024-04-01 Thread via GitHub


chia7712 commented on PR #15624:
URL: https://github.com/apache/kafka/pull/15624#issuecomment-2029638622

   @FrankYang0529 Could you please add following use cases to UT?
   
   1. call `lock` repeatedly - the later calls should throw exception
   2. call unlock after calling `lock` repeatedly - unlock should work
   3. ditto to `tryLock`, `unlock`, `destory`


-- 
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-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-16413: add FileLockTest [kafka]

2024-04-01 Thread via GitHub


FrankYang0529 commented on code in PR #15624:
URL: https://github.com/apache/kafka/pull/15624#discussion_r1546217077


##
core/src/test/java/kafka/utils/FileLockTest.java:
##
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kafka.utils;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+
+import java.io.File;
+import java.nio.channels.OverlappingFileLockException;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class FileLockTest {
+private static final String TEST_LOCK_FILE = "test.lock";

Review Comment:
   Updated it. Thanks.



-- 
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-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-16413: add FileLockTest [kafka]

2024-03-30 Thread via GitHub


FrankYang0529 commented on code in PR #15624:
URL: https://github.com/apache/kafka/pull/15624#discussion_r1545234876


##
core/src/test/java/kafka/utils/FileLockTest.java:
##
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kafka.utils;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+
+import java.io.File;
+import java.nio.channels.OverlappingFileLockException;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class FileLockTest {
+private static final String TEST_LOCK_FILE = "test.lock";

Review Comment:
   Thanks for the suggestion. I will update 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-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] KAFKA-16413: add FileLockTest [kafka]

2024-03-30 Thread via GitHub


chia7712 commented on code in PR #15624:
URL: https://github.com/apache/kafka/pull/15624#discussion_r1545233073


##
core/src/test/java/kafka/utils/FileLockTest.java:
##
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kafka.utils;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+
+import java.io.File;
+import java.nio.channels.OverlappingFileLockException;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class FileLockTest {
+private static final String TEST_LOCK_FILE = "test.lock";

Review Comment:
   Personally, I prefer to use `TestUtils.tempFile`. Otherwise, the remained 
file caused by terminated test can make us commit it accidentally.



-- 
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-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] KAFKA-16413: add FileLockTest [kafka]

2024-03-29 Thread via GitHub


FrankYang0529 opened a new pull request, #15624:
URL: https://github.com/apache/kafka/pull/15624

   Add unit tests for `FileLock`.
   
   Ref: https://github.com/apache/kafka/pull/15568#pullrequestreview-1950676267
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org