summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLvbo163 <lv.bo163@zte.com.cn>2018-03-07 17:28:22 +0800
committerLvbo163 <lv.bo163@zte.com.cn>2018-03-07 17:28:22 +0800
commit708ce4cfd811fc72588d414e6c0720d3ee632a23 (patch)
tree57e166505d9649e0e6476ad064cd73d406fd115d
parent750f9b934e29ea6c4a7a976890f04650b91b7c9a (diff)
add ut for SendPodWork
Issue-ID: MSB-166 Change-Id: I53dce8cf99cbd017672c8778201bb36316c09135 Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
-rw-r--r--src/kube2msb/kube2msb_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/kube2msb/kube2msb_test.go b/src/kube2msb/kube2msb_test.go
index 09f7a80..eea0f92 100644
--- a/src/kube2msb/kube2msb_test.go
+++ b/src/kube2msb/kube2msb_test.go
@@ -89,3 +89,24 @@ func TestSendServiceWork(t *testing.T) {
}
}
}
+
+func TestSendPodWork(t *testing.T) {
+
+ kubeWorkQueue := make(chan KubeWork, 1)
+ podObj := kapi.Pod{}
+
+ cases := []KubeWorkAction{
+ KubeWorkAddPod,
+ KubeWorkRemovePod,
+ KubeWorkUpdatePod,
+ }
+
+ for _, c := range cases {
+ sendPodWork(c, kubeWorkQueue, &podObj)
+ got := <-kubeWorkQueue
+
+ if got.Action != c {
+ t.Errorf("sendPodWork(%action, queue, service) got %gotAction", c, got.Action)
+ }
+ }
+}