Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(testutil): add unit tests and remove unused functions #937

Merged
merged 8 commits into from
Feb 3, 2025

Conversation

ijsong
Copy link
Member

@ijsong ijsong commented Dec 12, 2024

What this PR does

  • Added pkg/util/testutil/testutil_test.go for unit testing.
  • Removed unused functions from pkg/util/testutil/testutil.go.

@ijsong ijsong requested a review from hungryjang as a code owner December 12, 2024 09:40
Copy link

codecov bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.31%. Comparing base (2c3818a) to head (2f859d2).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #937      +/-   ##
==========================================
+ Coverage   79.08%   80.31%   +1.23%     
==========================================
  Files         180      179       -1     
  Lines       21615    21550      -65     
==========================================
+ Hits        17094    17308     +214     
+ Misses       3711     3467     -244     
+ Partials      810      775      -35     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ijsong ijsong force-pushed the test_netutil_add_tests_for_stoppablelistener branch from 44c7bb6 to eeb910a Compare December 13, 2024 01:53
@ijsong ijsong force-pushed the testutil_add_unit_tests_and_remove_unused_functions branch from 05fbd28 to 6a0c55f Compare December 13, 2024 01:53
@ijsong ijsong force-pushed the test_netutil_add_tests_for_stoppablelistener branch from eeb910a to e097a93 Compare December 13, 2024 02:02
@ijsong ijsong force-pushed the testutil_add_unit_tests_and_remove_unused_functions branch from 6a0c55f to 7500d39 Compare December 13, 2024 02:02
@ijsong ijsong force-pushed the test_netutil_add_tests_for_stoppablelistener branch from e097a93 to e5da418 Compare January 16, 2025 04:19
@ijsong ijsong force-pushed the testutil_add_unit_tests_and_remove_unused_functions branch from 7500d39 to fc72ef5 Compare January 16, 2025 04:19
@ijsong ijsong force-pushed the test_netutil_add_tests_for_stoppablelistener branch from e5da418 to 3821d9b Compare February 3, 2025 10:58
@ijsong ijsong force-pushed the testutil_add_unit_tests_and_remove_unused_functions branch from fc72ef5 to c9d5fa8 Compare February 3, 2025 10:58
- Add tests for StorageNodeMetadataDescriptor and LogStreamReplicaMetadataDescriptor
- Test methods: ToStorageNodeDescriptor, GetLogStream, Head, and Tail
- Ensure proper coverage for edge cases and nil values
- Add comments for SyncPosition.InvalidSyncPosition, SyncPosition.Invalid,
  SyncPosition.LessThan, SyncRange.InvalidSyncRange, and SyncRange.Validate
  methods.
- Add unit tests for SyncRange validation and invalid cases.
- replaced InvalidLogEntry with an empty LogEntry across the codebase
- removed proto/varlogpb/log_entry.go as it contained unused code
- updated related files to reflect these changes
- Removed unused functions from metadata.go
- Added comprehensive unit tests for metadata.go and metadata_test.go
- Improved test coverage for various scenarios
- Added `proto/varlogpb/replica_test.go` to test `EqualReplicas` and
  `ValidReplicas` functions.
- Included various test cases to ensure correct functionality.
- Added new file: proto/varlogpb/storage_node_test.go
- Includes tests for StorageNodeDescriptor validation
- Added unit tests for StoppableListener to cover various scenarios:
  - Valid and invalid addresses
  - Accepting connections after stopping
  - Successful connection acceptance
- Improved test coverage and ensured reliability of the StoppableListener
  implementation.
- Added `pkg/util/testutil/testutil_test.go` for unit testing.
- Removed unused functions from `pkg/util/testutil/testutil.go`.
@ijsong ijsong force-pushed the test_netutil_add_tests_for_stoppablelistener branch from 3821d9b to 30e2b27 Compare February 3, 2025 11:24
@ijsong ijsong force-pushed the testutil_add_unit_tests_and_remove_unused_functions branch from c9d5fa8 to 2f859d2 Compare February 3, 2025 11:24
Base automatically changed from test_netutil_add_tests_for_stoppablelistener to main February 3, 2025 12:17
@ijsong ijsong merged commit 6bb7f1d into main Feb 3, 2025
10 checks passed
@ijsong ijsong deleted the testutil_add_unit_tests_and_remove_unused_functions branch February 3, 2025 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants