aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/kube2msb/kube2msb_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/kube2msb/kube2msb_test.go b/src/kube2msb/kube2msb_test.go
index 435fb3f..09f7a80 100644
--- a/src/kube2msb/kube2msb_test.go
+++ b/src/kube2msb/kube2msb_test.go
@@ -18,6 +18,8 @@ package main
import (
"os"
"testing"
+
+ kapi "k8s.io/kubernetes/pkg/api"
)
func urlFormateValidate(t *testing.T, method string) {
@@ -66,3 +68,24 @@ func TestGetMSBUrl(t *testing.T) {
func TestGetKubeMasterUrl(t *testing.T) {
urlFormateValidate(t, "getKubeMasterUrl")
}
+
+func TestSendServiceWork(t *testing.T) {
+
+ kubeWorkQueue := make(chan KubeWork, 1)
+ serviceObj := kapi.Service{}
+
+ cases := []KubeWorkAction{
+ KubeWorkAddService,
+ KubeWorkRemoveService,
+ KubeWorkUpdateService,
+ }
+
+ for _, c := range cases {
+ sendServiceWork(c, kubeWorkQueue, &serviceObj)
+ got := <-kubeWorkQueue
+
+ if got.Action != c {
+ t.Errorf("sendServiceWork(%action, queue, service) got %gotAction", c, got.Action)
+ }
+ }
+}