Removed hostname/subdomain annotation.

This commit is contained in:
Klaus Ma
2017-04-06 15:32:21 +08:00
parent 41e9b80e5f
commit c2b629ee2a
14 changed files with 22 additions and 121 deletions

View File

@@ -29,7 +29,6 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/kubernetes/pkg/api/v1"
podapi "k8s.io/kubernetes/pkg/api/v1/pod"
apps "k8s.io/kubernetes/pkg/apis/apps/v1beta1"
"k8s.io/kubernetes/pkg/controller"
)
@@ -79,12 +78,12 @@ func TestIdentityMatches(t *testing.T) {
t.Error("identity matches for a Pod with the wrong namespace")
}
pod = newStatefulSetPod(set, 1)
delete(pod.Annotations, podapi.PodHostnameAnnotation)
pod.Spec.Hostname = ""
if identityMatches(set, pod) {
t.Error("identity matches for a Pod with no hostname")
}
pod = newStatefulSetPod(set, 1)
delete(pod.Annotations, podapi.PodSubdomainAnnotation)
pod.Spec.Subdomain = ""
if identityMatches(set, pod) {
t.Error("identity matches for a Pod with no subdomain")
}
@@ -138,7 +137,7 @@ func TestUpdateIdentity(t *testing.T) {
t.Error("updateIdentity failed to update the Pods namespace")
}
pod = newStatefulSetPod(set, 1)
delete(pod.Annotations, podapi.PodHostnameAnnotation)
pod.Spec.Hostname = ""
if identityMatches(set, pod) {
t.Error("identity matches for a Pod with no hostname")
}
@@ -147,7 +146,7 @@ func TestUpdateIdentity(t *testing.T) {
t.Error("updateIdentity failed to update the Pod's hostname")
}
pod = newStatefulSetPod(set, 1)
delete(pod.Annotations, podapi.PodSubdomainAnnotation)
pod.Spec.Subdomain = ""
if identityMatches(set, pod) {
t.Error("identity matches for a Pod with no subdomain")
}
@@ -155,15 +154,6 @@ func TestUpdateIdentity(t *testing.T) {
if !identityMatches(set, pod) {
t.Error("updateIdentity failed to update the Pod's subdomain")
}
pod = newStatefulSetPod(set, 1)
pod.Annotations = nil
if identityMatches(set, pod) {
t.Error("identity matches for a Pod no annotations")
}
updateIdentity(set, pod)
if !identityMatches(set, pod) {
t.Error("updateIdentity failed to update the Pod's annotations")
}
}
func TestUpdateStorage(t *testing.T) {