aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLvbo163 <lv.bo163@zte.com.cn>2018-03-06 09:31:39 +0800
committerLvbo163 <lv.bo163@zte.com.cn>2018-03-06 09:31:39 +0800
commit442a06a8f7c9bbc5f3aa40afe4298be709af94e6 (patch)
treef7067b8a64e2118622cb291a1b56b3172cb85ffe
parent4e13eabc333ec3b69009a266738c335eff01f2c3 (diff)
add ut for addPod of msb
Issue-ID: MSB-174 Change-Id: Ib76ac3d7619b5152ac92af35678555a859d5018e Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
-rw-r--r--src/kube2msb/msb_work_test.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/kube2msb/msb_work_test.go b/src/kube2msb/msb_work_test.go
index 9f5a823..b5ba681 100644
--- a/src/kube2msb/msb_work_test.go
+++ b/src/kube2msb/msb_work_test.go
@@ -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) {