-
Notifications
You must be signed in to change notification settings - Fork 498
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
Add unit tests for dm cluster CRD, discovery service, dm-master/dm-worker member manager #3310
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3310 +/- ##
==========================================
+ Coverage 41.89% 48.41% +6.51%
==========================================
Files 159 159
Lines 16690 16730 +40
==========================================
+ Hits 6992 8099 +1107
+ Misses 9045 7863 -1182
- Partials 653 768 +115
Flags with carried forward coverage won't be shown. Click here to find out more. |
/test pull-e2e-kind |
/test pull-e2e-kind |
@@ -539,7 +542,10 @@ func getNewMasterSetForDMCluster(dc *v1alpha1.DMCluster, cm *corev1.ConfigMap) ( | |||
dcName := dc.Name | |||
baseMasterSpec := dc.BaseMasterSpec() | |||
instanceName := dc.GetInstanceName() | |||
masterConfigMap := cm.Name | |||
masterConfigMap := "" | |||
if cm != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if cm is nil here, should we return error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's unnecessary🤔
@@ -360,7 +360,10 @@ func getNewWorkerSetForDMCluster(dc *v1alpha1.DMCluster, cm *corev1.ConfigMap) ( | |||
dcName := dc.Name | |||
baseWorkerSpec := dc.BaseWorkerSpec() | |||
instanceName := dc.GetInstanceName() | |||
workerConfigMap := cm.Name | |||
workerConfigMap := "" | |||
if cm != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
@@ -1173,7 +1173,7 @@ func TestGetNewMasterSetForDMCluster(t *testing.T) { | |||
|
|||
for _, tt := range tests { | |||
t.Run(tt.name, func(t *testing.T) { | |||
sts, err := getNewMasterSetForDMCluster(&tt.dc, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a case to cover the nil
cm case.
/test pull-e2e-kind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…rker member manager (pingcap#3310) * add UT for dmcluster configurations, dmapi and dm-master/dm-worker member manager
What problem does this PR solve?
#2868
Add UT part 1.
What is changed and how does it work?
Add unit tests for dm cluster CRD, discovery service, dm-master/dm-worker member manager.
Also fix some small bugs.
Check List
Tests
Code changes
Does this PR introduce a user-facing change?: