Ported TestImportantURLs to native ginkgo syntax #4179

This commit is contained in:
Robert Rati 2015-02-06 10:30:16 -05:00
parent a1dcec8a1c
commit d75d36f3d3

View File

@ -17,17 +17,24 @@ limitations under the License.
package e2e package e2e
import ( import (
"fmt"
"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"
) )
// TestImportantURLs validates that URLs that people depend on haven't moved. // TestImportantURLs validates that URLs that people depend on haven't moved.
// ***IMPORTANT*** Do *not* fix this test just by changing the path. If you moved a URL // ***IMPORTANT*** Do *not* fix this test just by changing the path. If you moved a URL
// you can break upstream dependencies. // you can break upstream dependencies.
func TestImportantURLs(c *client.Client) bool { var _ = Describe("TestImportantURLs", func() {
var c *client.Client
BeforeEach(func() {
c = loadClientOrDie()
})
It("should provide unchanging URLs", func() {
tests := []struct { tests := []struct {
path string path string
}{ }{
@ -35,25 +42,15 @@ func TestImportantURLs(c *client.Client) bool {
{path: "/healthz"}, {path: "/healthz"},
// TODO: test proxy links here // TODO: test proxy links here
} }
ok := true
for _, test := range tests { for _, test := range tests {
glog.Infof("testing: %s", test.path) By(fmt.Sprintf("testing: %s", test.path))
data, err := c.RESTClient.Get(). data, err := c.RESTClient.Get().
AbsPath(test.path). AbsPath(test.path).
Do(). Do().
Raw() Raw()
if err != nil { if err != nil {
glog.Errorf("Failed: %v\nBody: %s", err, string(data)) Fail(fmt.Sprintf("Failed: %v\nBody: %s", err, string(data)))
ok = false
} }
} }
return ok
}
var _ = Describe("TestImportantURLs", 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(TestImportantURLs(loadClientOrDie())).To(BeTrue())
}) })
}) })