Converted TestKubernetesROService to native ginkgo syntax #4162

This commit is contained in:
Robert Rati
2015-02-05 08:59:41 -05:00
parent d44c1d5b84
commit eefd7ace56

View File

@@ -17,15 +17,23 @@ limitations under the License.
package e2e package e2e
import ( import (
"fmt"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client" "github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/golang/glog"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
) )
func TestKubernetesROService(c *client.Client) bool { var _ = Describe("TestKubernetesROService", func() {
var c *client.Client
BeforeEach(func() {
c = loadClientOrDie()
})
It("should pass", func() {
svc := api.ServiceList{} svc := api.ServiceList{}
err := c.Get(). err := c.Get().
Namespace("default"). Namespace("default").
@@ -33,8 +41,7 @@ func TestKubernetesROService(c *client.Client) bool {
Do(). Do().
Into(&svc) Into(&svc)
if err != nil { if err != nil {
glog.Errorf("unexpected error listing services using ro service: %v", err) Fail(fmt.Sprintf("unexpected error listing services using ro service: %v", err))
return false
} }
var foundRW, foundRO bool var foundRW, foundRO bool
for i := range svc.Items { for i := range svc.Items {
@@ -45,22 +52,7 @@ func TestKubernetesROService(c *client.Client) bool {
foundRO = true foundRO = true
} }
} }
if !foundRW { Expect(foundRW).To(Equal(true))
glog.Error("no RW service found") Expect(foundRO).To(Equal(true))
}
if !foundRO {
glog.Error("no RO service found")
}
if !foundRW || !foundRO {
return false
}
return true
}
var _ = Describe("TestKubernetesROService", func() {
It("should pass", func() {
// TODO: Instead of OrDie, client should Fail the test if there's a problem.
// In general tests should Fail() instead of glog.Fatalf().
Expect(TestKubernetesROService(loadClientOrDie())).To(BeTrue())
}) })
}) })