Merge pull request #5732 from zmerlynn/i5722

service.go e2e: Cleanup ELBs from previous runs
This commit is contained in:
Maxwell Forbes 2015-03-20 15:34:53 -07:00
commit 0250fcfd8f

View File

@ -245,7 +245,8 @@ var _ = Describe("Services", func() {
close(done) close(done)
}() }()
}, 240.0) }, 240.0)
It("should correctly serve identically named services in different namespaces on different external IP addresses", func(done Done) {
It("should correctly serve identically named services in different namespaces on different external IP addresses", func() {
serviceNames := []string{"services-namespace-test0"} // Could add more here, but then it takes longer. serviceNames := []string{"services-namespace-test0"} // Could add more here, but then it takes longer.
namespaces := []string{"namespace0", "namespace1"} // As above. namespaces := []string{"namespace0", "namespace1"} // As above.
labels := map[string]string{ labels := map[string]string{
@ -261,11 +262,16 @@ var _ = Describe("Services", func() {
CreateExternalLoadBalancer: true, CreateExternalLoadBalancer: true,
}, },
} }
// Always delete any turds from a previous run.
for _, namespace := range namespaces {
for _, serviceName := range serviceNames {
By("cleanup previous service " + serviceName + " in namespace " + namespace)
c.Services(namespace).Delete(serviceName)
}
}
publicIPs := []string{} publicIPs := []string{}
// We defer Gingko pieces that may Fail, so clean up at the end.
defer func() {
close(done)
}()
for _, namespace := range namespaces { for _, namespace := range namespaces {
for _, serviceName := range serviceNames { for _, serviceName := range serviceNames {
service.ObjectMeta.Name = serviceName service.ObjectMeta.Name = serviceName
@ -282,7 +288,7 @@ var _ = Describe("Services", func() {
} }
} }
validateUniqueOrFail(publicIPs) validateUniqueOrFail(publicIPs)
}, 240.0) })
}) })
func validateUniqueOrFail(s []string) { func validateUniqueOrFail(s []string) {