Skip to content

test: add ut#866

Merged
BSWANG merged 10 commits intoAliyunContainerService:mainfrom
l1b0k:ut
Aug 1, 2025
Merged

test: add ut#866
BSWANG merged 10 commits intoAliyunContainerService:mainfrom
l1b0k:ut

Conversation

@l1b0k
Copy link
Collaborator

@l1b0k l1b0k commented Aug 1, 2025

No description provided.

l1b0k added 8 commits August 1, 2025 13:37
- Replace github.com/boltdb/bolt with go.etcd.io/bbolt
- Update go.etcd.io/bbolt to v1.4.2
- Update github.com/spf13/pflag to v1.0.6

Signed-off-by: l1b0k <libokang.lbk@alibaba-inc.com>
…s/ptr

- Remove custom ptr function and use k8s.io/utils/ptr instead
- Update all pointer-related test cases to use the new ptr.To() function
- This change improves code readability and reduces maintenance overhead

Signed-off-by: l1b0k <libokang.lbk@alibaba-inc.com>
- Add unit tests for ENI and ENIIP types in daemon package
- Implement tests for GetResourceID, GetType, and ToResItems methods
- Add unit tests for scheme registration and REST mapper
- Test scope registration for cluster and namespaced resources

Signed-off-by: l1b0k <libokang.lbk@alibaba-inc.com>
- Implement mock interface for testing
- Add tests for GetInstanceMeta and Init functions
- Verify ECS struct implements the Interface

Signed-off-by: l1b0k <libokang.lbk@alibaba-inc.com>
- Implement multiple test cases to verify the behavior of storeRuntimeConfig function
- Test scenarios include:
  - Handling Cilium and Terway plugins
  - Storing network policy provider and data path information
  - Error handling for invalid or missing plugin types
  - Testing with empty plugins list
  - Verifying load and save errors
- Add test for isMounted function

Signed-off-by: l1b0k <libokang.lbk@alibaba-inc.com>
- Add a new context to test the setup of DummyReconciler
- Create a new manager instance for testing
- Verify that SetupWithManager does not return an error

Signed-off-by: l1b0k <libokang.lbk@alibaba-inc.com>
- Implement mock handlers and resources for testing
- Add tests for tracer registration, unregistration, and resource management
- Verify event recording functionality
- Validate resource mapping registration and retrieval

Signed-off-by: l1b0k <libokang.lbk@alibaba-inc.com>
- Add test file net_test.go to cmd/terway-cli
- Implement unit tests for getNetInterfaces and getInterfaceByMAC functions
- Use testify library for assertions

Signed-off-by: l1b0k <libokang.lbk@alibaba-inc.com>
@l1b0k l1b0k requested a review from BSWANG August 1, 2025 08:05
l1b0k added 2 commits August 1, 2025 16:06
- Add tests for gcPolicyRoutes, gcLeakedRules, gcRoutes, and gcTCFilters functions
- Create mock network environments for testing using netlink and testutils- Validate garbage collection behavior for various scenarios, including:
  - Valid and invalid MAC addresses
  - Empty and non-empty links
  - Routes and filters to be collected
  - Handling of invalid IPs and nil values
- Include helper function for creating mock policy routes

Signed-off-by: l1b0k <libokang.lbk@alibaba-inc.com>
- Add tests for CreateNetworkInterfaceOptions.EFLO method
- Add tests for AssignPrivateIPAddressOptions.ApplyAssignPrivateIPAddress and EFLO methods
- Add tests for AssignIPv6AddressesOptions.ApplyAssignIPv6Addresses method
- Cover various scenarios including valid inputs, missing required fields, and invalid IP/IPv6 counts

Signed-off-by: l1b0k <libokang.lbk@alibaba-inc.com>
@codecov
Copy link

codecov bot commented Aug 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.57%. Comparing base (6abd178) to head (94d77cc).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #866      +/-   ##
==========================================
+ Coverage   42.15%   44.57%   +2.41%     
==========================================
  Files         130      130              
  Lines       18984    18984              
==========================================
+ Hits         8003     8462     +459     
+ Misses      10119     9628     -491     
- Partials      862      894      +32     
Flag Coverage Δ
unittests 44.57% <100.00%> (+2.41%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@BSWANG BSWANG merged commit 23cef2a into AliyunContainerService:main Aug 1, 2025
12 of 13 checks passed
@l1b0k l1b0k deleted the ut branch August 11, 2025 06:24
cursor bot pushed a commit that referenced this pull request Sep 7, 2025
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