diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/kube2msb/kube_work_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/kube2msb/kube_work_test.go b/src/kube2msb/kube_work_test.go index a96f5c9..f67608a 100644 --- a/src/kube2msb/kube_work_test.go +++ b/src/kube2msb/kube_work_test.go @@ -218,3 +218,32 @@ func TestAddPodKube(t *testing.T) { } } + + +func TestRemovePodKube(t *testing.T) { + client := newClientBookKeeper() + msbWorkQueue := make(chan MSBWork, 10) + client.msbQueue = msbWorkQueue + + // exception process + // TODO ServiceKey not set , cannot check result for there would be no return + podWithoutServiceKey := kapi.Pod{} + client.RemovePod(&podWithoutServiceKey) + + // TODO Pod not exist , cannot check result for there would be no return + podNotExist := createMockPod("podNotExistTest", "192.168.10.10") + client.RemovePod(podNotExist) + + // normal process + pod := createMockPod("removePodTest", "192.168.10.10") + client.AddPod(pod) + if _, ok := client.pods[pod.Name]; !ok { + t.Errorf("add pod error, pod not exists in client.pods") + } + msbWorkPodValidate(t, msbWorkQueue, pod, MSBWorkAddPod) + client.RemovePod(pod) + msbWorkPodValidate(t, msbWorkQueue, pod, MSBWorkRemovePod) + if _, ok := client.pods[pod.Name]; ok { + t.Errorf("remove pod error, pod still exists in client.pods") + } +}
\ No newline at end of file |