kubesphere / kubesphere/ks-devops

TestAddCredentialFinalizers UT randomly fails

Open
#135 5 comments 0 reactions 0 assignees View on GitHub
kind/bug
Dominant language
Go
Stars
164
Forks
140
PR merge metrics
No merged PRs in 30d

Description

**Describe the Bug**

TestAddCredentialFinalizers UT randomly fails.

ref: https://github.com/kubesphere/kubesphere/runs/2771946724?check_suite_focus=true

**Versions Used**
KubeSphere: 3.1.0
Kubernetes: (If KubeSphere installer used, you can skip this)

**Environment**
How many nodes and their hardware configuration:

For example: CentOS 7.5 / 3 masters: 8cpu/8g; 3 nodes: 8cpu/16g
(and other info are welcomed to help us debugging)

**How To Reproduce**

```
I0608 08:40:31.354345 28018 devopscredential_controller.go:220] namespace 'test-123/test' in work queue no longer exists
--- FAIL: TestAddCredentialFinalizers (0.00s)
devopscredential_controller_test.go:191: 1 additional expected actions:[{ActionImpl:{Namespace:test-123 Verb:update Resource:/v1, Resource=secrets Subresource:} Object:&Secret{ObjectMeta:{test test-123 0 0001-01-01 00:00:00 +0000 UTC map[] map[credential.devops.kubesphere.io/autosync:true credential.devops.kubesphere.io/syncstatus:successful] [] [finalizers.kubesphere.io/credential] []},Data:map[string][]byte{},Type:credential.devops.kubesphere.io/test,StringData:map[string]string{},Immutable:nil,}}]
devopscredential_controller_test.go:200: credential &Secret{ObjectMeta:{test test-123 0 0001-01-01 00:00:00 +0000 UTC map[] map[credential.devops.kubesphere.io/autosync:true credential.devops.kubesphere.io/syncstatus:successful] [] [finalizers.kubesphere.io/credential] []},Data:map[string][]byte{},Type:credential.devops.kubesphere.io/test,StringData:map[string]string{},Immutable:nil,} not match
&Secret{ObjectMeta:{test test-123 0 0001-01-01 00:00:00 +0000 UTC map[] map[credential.devops.kubesphere.io/autosync:true] [] [] []},Data:map[string][]byte{},Type:credential.devops.kubesphere.io/test,StringData:map[string]string{},Immutable:nil,}
FAIL
```

**Expected behavior**
UT test should always pass.

/kind bug
/area devops
/cc @kubesphere/devops-admin

Contributor guide

Open the contributing guide

Research direction

Start with devopscredential_controller_test.go, especially TestAddCredentialFinalizers and the expected actions around the reported failures, then read the related logic in devopscredential_controller.go. Run the targeted unit test repeatedly to reproduce the intermittent result; done means the test passes consistently without unexpected actions.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
devops, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.