Move "extra" namespaces into framework

Now an aborted test will delete namespaces.  Hopefully this means less GCE
leaks.
This commit is contained in:
Tim Hockin
2016-02-05 21:38:52 -08:00
parent 677d4d6dbc
commit ff3f9f6bcc
4 changed files with 33 additions and 47 deletions

View File

@@ -54,9 +54,6 @@ const loadBalancerLagTimeout = 2 * time.Minute
//TODO: once support ticket 21807001 is resolved, reduce this timeout back to something reasonable
const loadBalancerCreateTimeout = 20 * time.Minute
// How long to wait for a namespace to be deleted.
const namespaceDeleteTimeout = 5 * time.Minute
// This should match whatever the default/configured range is
var ServiceNodePortRange = utilnet.PortRange{Base: 30000, Size: 2768}
@@ -64,7 +61,6 @@ var _ = Describe("Services", func() {
f := NewFramework("services")
var c *client.Client
var extraNamespaces []string
BeforeEach(func() {
var err error
@@ -72,20 +68,6 @@ var _ = Describe("Services", func() {
Expect(err).NotTo(HaveOccurred())
})
AfterEach(func() {
if testContext.DeleteNamespace {
for _, ns := range extraNamespaces {
By(fmt.Sprintf("Destroying namespace %v", ns))
if err := deleteNS(c, ns, namespaceDeleteTimeout); err != nil {
Failf("Couldn't delete namespace %s: %s", ns, err)
}
}
extraNamespaces = nil
} else {
Logf("Found DeleteNamespace=false, skipping namespace deletion!")
}
})
// TODO: We get coverage of TCP/UDP and multi-port services through the DNS test. We should have a simpler test for multi-port TCP here.
It("should provide secure master service [Conformance]", func() {
@@ -429,11 +411,10 @@ var _ = Describe("Services", func() {
Logf("namespace for TCP test: %s", ns1)
By("creating a second namespace")
namespacePtr, err := createTestingNS("services", c, nil)
namespacePtr, err := f.CreateNamespace("services", nil)
Expect(err).NotTo(HaveOccurred())
ns2 := namespacePtr.Name // LB2 in ns2 on UDP
Logf("namespace for UDP test: %s", ns2)
extraNamespaces = append(extraNamespaces, ns2)
jig := NewServiceTestJig(c, serviceName)
nodeIP := pickNodeIP(jig.Client) // for later