add ut for addPod of msb 69/34169/1
authorLvbo163 <lv.bo163@zte.com.cn>
Tue, 6 Mar 2018 01:31:39 +0000 (09:31 +0800)
committerLvbo163 <lv.bo163@zte.com.cn>
Tue, 6 Mar 2018 01:31:39 +0000 (09:31 +0800)
Issue-ID: MSB-174

Change-Id: Ib76ac3d7619b5152ac92af35678555a859d5018e
Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
src/kube2msb/msb_work_test.go

index 9f5a823..b5ba681 100644 (file)
@@ -24,7 +24,7 @@ import (
        "testing"
 )
 
-func TestAddServiceMsb(t *testing.T) {
+func addServiceOrPodTest(t *testing.T, addType string) {
        handler := func(res http.ResponseWriter, req *http.Request) {
                if req.Method != "POST" {
                        t.Errorf("Register() request method should be 'Post' not %s", req.Method)
@@ -69,7 +69,19 @@ func TestAddServiceMsb(t *testing.T) {
                "enable_ssl":true
        }]`
 
-       client.AddService("192.168.1.10", serviceInfo)
+       if addType == "Service" {
+               client.AddService("192.168.1.10", serviceInfo)
+       } else {
+               client.AddPod("192.168.1.10", serviceInfo)
+       }
+}
+
+func TestAddServiceMsb(t *testing.T) {
+       addServiceOrPodTest(t, "Service")
+}
+
+func TestAddPodMsb(t *testing.T) {
+       addServiceOrPodTest(t, "Pod")
 }
 
 func TestMergeIP(t *testing.T) {