INNER CODE UNIT · Go
TestPodIPIndexFuncInactive
jtblin/kube2iam · namespace_test.go:216
func TestPodIPIndexFuncInactive(t *testing.T) {
pod := &v1.Pod{Status: v1.PodStatus{PodIP: "10.0.0.1", Phase: v1.PodSucceeded}}
keys, err := PodIPIndexFunc(pod)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if len(keys) != 0 {
t.Errorf("expected empty keys for inactive pod, got %v", keys)
}
}
func TestPodIPIndexFuncWrongType(t *testing.T) {
_, err := PodIPIndexFunc("not-a-pod")
if err == nil {
t.Error("expected error for wrong type, got nil")
}
}