You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "NiMv1 (via GitHub)" <gi...@apache.org> on 2025/12/25 10:19:25 UTC
[PR] test: add unit tests for core module (LockStatus, MessageType, ProtocolConstants) [incubator-seata]
NiMv1 opened a new pull request, #7901:
URL: https://github.com/apache/incubator-seata/pull/7901
## What is the purpose of the change
This PR adds unit tests for the core module to improve test coverage, addressing issue #6502.
## Brief changelog
- Add LockStatusTest.java with tests for:
- getCode() method
- get(byte) and get(int) methods
- Invalid code exception handling
- Enum values validation
- Add MessageTypeTest.java with tests for:
- Version and type constants
- Global transaction type constants
- Branch transaction type constants
- Merge and registration type constants
- Add ProtocolConstantsTest.java with tests for:
- Magic code bytes
- Version constants
- Frame length and head length
- Message type constants
- Configured codec and compressor validation
- Update changes/en-us/2.x.md with changelog entry
- Add contributor to the list
## Verifying this change
This change is a test-only change and can be verified by running:
\\\ash
mvn test -pl core -Dtest=LockStatusTest,MessageTypeTest,ProtocolConstantsTest
\\\
## Checklist
- [x] Make sure that the change is in accordance with [the contributing guide](https://github.com/apache/incubator-seata/blob/2.x/CONTRIBUTING.md)
- [x] Add unit tests for the change
- [x] Update the changelog
Closes #6502 (partial)
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] test: add unit tests for core module (LockStatus, MessageType, ProtocolConstants) [incubator-seata]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #7901:
URL: https://github.com/apache/incubator-seata/pull/7901#issuecomment-3692899854
## [Codecov](https://app.codecov.io/gh/apache/incubator-seata/pull/7901?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 71.14%. Comparing base ([`340aa3c`](https://app.codecov.io/gh/apache/incubator-seata/commit/340aa3caa10f01c0d510e718027fa90fdfd658d9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`d642431`](https://app.codecov.io/gh/apache/incubator-seata/commit/d64243168f28a30dcca1882475e281718c42b72e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## 2.x #7901 +/- ##
============================================
- Coverage 71.20% 71.14% -0.06%
Complexity 797 797
============================================
Files 1300 1300
Lines 49620 49620
Branches 5874 5874
============================================
- Hits 35331 35304 -27
- Misses 11371 11401 +30
+ Partials 2918 2915 -3
```
[see 8 files with indirect coverage changes](https://app.codecov.io/gh/apache/incubator-seata/pull/7901/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
[](https://app.codecov.io/gh/apache/incubator-seata/pull/7901?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] test: add unit tests for core module (LockStatus, MessageType, ProtocolConstants) [incubator-seata]
Posted by "NiMv1 (via GitHub)" <gi...@apache.org>.
NiMv1 commented on PR #7901:
URL: https://github.com/apache/incubator-seata/pull/7901#issuecomment-3697131226
Thank you for the feedback @funky-eyes! I've removed all @author tags from the test files in commit e72acc53c. I understand that ASF emphasizes community collaboration over individual attribution. Ready for re-review!
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] test: add unit tests for core module (LockStatus, MessageType, ProtocolConstants) [incubator-seata]
Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes commented on code in PR #7901:
URL: https://github.com/apache/incubator-seata/pull/7901#discussion_r2650051349
##########
core/src/test/java/org/apache/seata/core/protocol/MessageTypeTest.java:
##########
@@ -0,0 +1,88 @@
+/*
+ * 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 org.apache.seata.core.protocol;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * Tests for {@link MessageType}.
+ *
+ * @author NiMv1
Review Comment:
```suggestion
```
##########
core/src/test/java/org/apache/seata/core/model/LockStatusTest.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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 org.apache.seata.core.model;
+
+import org.apache.seata.common.exception.ShouldNeverHappenException;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * Tests for {@link LockStatus}.
+ *
+ * @author NiMv1
Review Comment:
```suggestion
```
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] test: add unit tests for core module (LockStatus, MessageType, ProtocolConstants) [incubator-seata]
Posted by "funky-eyes (via GitHub)" <gi...@apache.org>.
funky-eyes merged PR #7901:
URL: https://github.com/apache/incubator-seata/pull/7901
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org