Skip to content

Commit cc438b0

Browse files
committed
fix unit test
1 parent 2198e93 commit cc438b0

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

controller/module_deployment_controller/runtime_info_store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ func getDeploymentMatchLabels(dep appsv1.Deployment) (eqLabels, neLabels map[str
326326
if !has {
327327
neLabels[expressions.Key] = neValues
328328
} else {
329-
neLabels[expressions.Key] = intersection(oldValues, neValues)
329+
neLabels[expressions.Key] = union(oldValues, neValues)
330330
}
331331
}
332332
}

module_tunnels/koupleless_mqtt_tunnel/mqtt_tunnel.go

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -127,23 +127,25 @@ func (m *MqttTunnel) Start(ctx context.Context, clientID, env string) (err error
127127
}
128128

129129
go func() {
130-
m.Cache.WaitForCacheSync(ctx)
131-
vkUtils.TimedTaskWithInterval(ctx, time.Minute, func(ctx context.Context) {
132-
nodeList := corev1.NodeList{}
133-
envRequirement, _ := labels.NewRequirement(vkModel.LabelKeyOfEnv, selection.In, []string{m.env})
134-
componentRequirement, _ := labels.NewRequirement(vkModel.LabelKeyOfComponent, selection.In, []string{vkModel.ComponentVNode})
135-
m.Client.List(ctx, &nodeList, &client.ListOptions{
136-
LabelSelector: labels.NewSelector().Add(*envRequirement, *componentRequirement),
137-
})
138-
for _, node := range nodeList.Items {
139-
for _, condition := range node.Status.Conditions {
140-
if condition.Type == corev1.NodeReady && condition.Status != corev1.ConditionTrue {
141-
// base not ready, delete from api server
142-
m.Client.Delete(ctx, &node)
130+
if m.Cache != nil {
131+
m.Cache.WaitForCacheSync(ctx)
132+
vkUtils.TimedTaskWithInterval(ctx, time.Minute, func(ctx context.Context) {
133+
nodeList := corev1.NodeList{}
134+
envRequirement, _ := labels.NewRequirement(vkModel.LabelKeyOfEnv, selection.In, []string{m.env})
135+
componentRequirement, _ := labels.NewRequirement(vkModel.LabelKeyOfComponent, selection.In, []string{vkModel.ComponentVNode})
136+
m.Client.List(ctx, &nodeList, &client.ListOptions{
137+
LabelSelector: labels.NewSelector().Add(*envRequirement, *componentRequirement),
138+
})
139+
for _, node := range nodeList.Items {
140+
for _, condition := range node.Status.Conditions {
141+
if condition.Type == corev1.NodeReady && condition.Status != corev1.ConditionTrue {
142+
// base not ready, delete from api server
143+
m.Client.Delete(ctx, &node)
144+
}
143145
}
144146
}
145-
}
146-
})
147+
})
148+
}
147149
}()
148150

149151
go func() {

0 commit comments

Comments
 (0)