address review comments, and fix panic in ingress e2e

This commit is contained in:
mfanjie 2016-08-18 09:49:08 +08:00
parent 6ecea5944c
commit a1bed2723e
4 changed files with 10 additions and 8 deletions

View File

@ -95,7 +95,9 @@ func clusterIsReadyOrFail(f *framework.Framework, context *framework.E2EContext)
framework.Logf("Cluster %s is Ready", context.Name)
}
func waitforclustersReadness(f *framework.Framework, clusterSize int) *federationapi.ClusterList {
// waitForAllClustersReady wait for all clusters defined in e2e context to be created
// return ClusterList until the listed cluster items equals clusterCount
func waitForAllClustersReady(f *framework.Framework, clusterCount int) *federationapi.ClusterList {
var clusterList *federationapi.ClusterList
if err := wait.PollImmediate(framework.Poll, FederatedServiceTimeout, func() (bool, error) {
var err error
@ -103,8 +105,8 @@ func waitforclustersReadness(f *framework.Framework, clusterSize int) *federatio
if err != nil {
return false, err
}
framework.Logf("%d clusters registered, waiting for %d", len(clusterList.Items), clusterSize)
if len(clusterList.Items) == clusterSize {
framework.Logf("%d clusters registered, waiting for %d", len(clusterList.Items), clusterCount)
if len(clusterList.Items) == clusterCount {
return true, nil
}
return false, nil
@ -182,7 +184,7 @@ func registerClusters(clusters map[string]*cluster, userAgentName, federationNam
}
By("Obtaining a list of all the clusters")
clusterList := waitforclustersReadness(f, len(contexts))
clusterList := waitForAllClustersReady(f, len(contexts))
framework.Logf("Checking that %d clusters are Ready", len(contexts))
for _, context := range contexts {

View File

@ -619,7 +619,7 @@ type E2EContext struct {
func (f *Framework) GetUnderlyingFederatedContexts() []E2EContext {
if !f.federated {
Failf("geUnderlyingFederatedContexts called on non-federated framework")
Failf("getUnderlyingFederatedContexts called on non-federated framework")
}
kubeconfig := KubeConfig{}

View File

@ -70,8 +70,6 @@ var _ = framework.KubeDescribe("Loadbalancing: L7 [Feature:Ingress]", func() {
ns = f.Namespace.Name
})
conformanceTests = createComformanceTests(jig, ns)
// Before enabling this loadbalancer test in any other test list you must
// make sure the associated project has enough quota. At the time of this
// writing a GCE project is allowed 3 backend services by default. This
@ -107,6 +105,7 @@ var _ = framework.KubeDescribe("Loadbalancing: L7 [Feature:Ingress]", func() {
})
It("should conform to Ingress spec", func() {
conformanceTests = createComformanceTests(jig, ns)
for _, t := range conformanceTests {
By(t.entryLog)
t.execute()

View File

@ -51,6 +51,7 @@ import (
utilyaml "k8s.io/kubernetes/pkg/util/yaml"
"k8s.io/kubernetes/test/e2e/framework"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@ -142,7 +143,7 @@ func createComformanceTests(jig *testJig, ns string) []conformanceTests {
}
ing.Spec.Rules = newRules
})
fmt.Sprintf("Checking that %s is not exposed by polling for failure", pathToFail)
By("Checking that " + pathToFail + " is not exposed by polling for failure")
route := fmt.Sprintf("http://%v%v", jig.address, pathToFail)
ExpectNoError(jig.pollURL(route, updateURLMapHost, lbCleanupTimeout, &http.Client{Timeout: reqTimeout}, true))
},