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

pkg/search: unit test controller #5810

Merged

Conversation

mohamedawnallah
Copy link
Contributor

Description

In this commit, we unit test karmada search controller on creating new controller and handling the following events watched by the shared informer: addCluster, updateCluster, deleteCluster, addResourceRegistry, updateResourceRegistry, and deleteResourceRegistry making sure those handled and cached correctly to the indexer.

What type of PR is this?

Which issue(s) this PR fixes:
Part of #5491

Does this PR introduce a user-facing change?:

NONE

@codecov-commenter
Copy link

codecov-commenter commented Nov 12, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.

Project coverage is 43.72%. Comparing base (c059c68) to head (dc2eea8).
Report is 23 commits behind head on master.

Files with missing lines Patch % Lines
pkg/search/controller.go 33.33% 4 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5810      +/-   ##
==========================================
+ Coverage   42.88%   43.72%   +0.83%     
==========================================
  Files         656      656              
  Lines       55888    55925      +37     
==========================================
+ Hits        23968    24452     +484     
+ Misses      30369    29884     -485     
- Partials     1551     1589      +38     
Flag Coverage Δ
unittests 43.72% <33.33%> (+0.83%) ⬆️

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.

In this commit, we unit test karmada search controller
on creating new controller and handling the following events
watched by the shared informer: `addCluster`, `updateCluster`,
`deleteCluster`, `addResourceRegistry`, `updateResourceRegistry`,
and `deleteResourceRegistry` making sure those handled and cached
correctly to the indexer.

Signed-off-by: Mohamed Awnallah <[email protected]>
Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks~
/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Nov 15, 2024
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: XiShanYongYe-Chang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 15, 2024
@karmada-bot karmada-bot merged commit 3acc14c into karmada-io:master Nov 15, 2024
18 checks passed
@chaosi-zju
Copy link
Member

Hi @mohamedawnallah, here is a UT ci failure, maybe related to your PR.

https://github.com/karmada-io/karmada/actions/runs/11884685448/job/33113394945?pr=5814

FAIL pkg/search.TestDeleteClusterEventHandler (-1.00s)
FAIL pkg/search.TestDeleteClusterEventHandler/AddAllEventHandlers_TriggerDeleteClusterEvent_DeletedClusterAddedToWorkQueue (-1.00s)

=== Failed
=== FAIL: pkg/search  (0.00s)
panic: test timed out after 10m0s
running tests:
	TestDeleteClusterEventHandler (9m59s)
	TestDeleteClusterEventHandler/AddAllEventHandlers_TriggerDeleteClusterEvent_DeletedClusterAddedToWorkQueue (9m59s)

goroutine 197 [running]:
testing.(*M).startAlarm.func1()
	/opt/hostedtoolcache/go/1.22.9/x64/src/testing/testing.go:2366 +0x265
created by time.goFunc
	/opt/hostedtoolcache/go/1.22.9/x64/src/time/sleep.go:177 +0x45

goroutine 1 [chan receive, 10 minutes]:
testing.(*T).Run(0xc0006951e0, {0x3e8af38, 0x1d}, 0x3f99900)
	/opt/hostedtoolcache/go/1.22.9/x64/src/testing/testing.go:1750 +0x851
testing.runTests.func1(0xc0006951e0)
	/opt/hostedtoolcache/go/1.22.9/x64/src/testing/testing.go:2161 +0x86
testing.tRunner(0xc0006951e0, 0xc00006db00)
	/opt/hostedtoolcache/go/1.22.9/x64/src/testing/testing.go:1689 +0x21f
testing.runTests(0xc00013d8f0, {0x5cb6420, 0x8, 0x8}, {0xc00006dba8?, 0xc00006dbf0?, 0x5cd9280?})
	/opt/hostedtoolcache/go/1.22.9/x64/src/testing/testing.go:2159 +0x8bf
testing.(*M).Run(0xc00065c320)
	/opt/hostedtoolcache/go/1.22.9/x64/src/testing/testing.go:2027 +0xf18
main.main()
	_testmain.go:95 +0x2e5

goroutine 150 [select]:
k8s.io/client-go/util/workqueue.(*delayingType[...]).waitingLoop(0x444f9e0)
	/home/runner/work/karmada/karmada/vendor/k8s.io/client-go/util/workqueue/delaying_queue.go:304 +0x4b9
created by k8s.io/client-go/util/workqueue.newDelayingQueue[...] in goroutine 149
	/home/runner/work/karmada/karmada/vendor/k8s.io/client-go/util/workqueue/delaying_queue.go:141 +0x3c9

@XiShanYongYe-Chang
Copy link
Member

Hi @mohamedawnallah, can you help take a look of #5856

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants