From 442a06a8f7c9bbc5f3aa40afe4298be709af94e6 Mon Sep 17 00:00:00 2001 From: Lvbo163 Date: Tue, 6 Mar 2018 09:31:39 +0800 Subject: add ut for addPod of msb Issue-ID: MSB-174 Change-Id: Ib76ac3d7619b5152ac92af35678555a859d5018e Signed-off-by: Lvbo163 --- src/kube2msb/msb_work_test.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') 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) { -- cgit 1.2.3-korg