Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Allow network end-to-end test to be run in parallel" #3766

Merged
merged 1 commit into from
Jan 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 7 additions & 11 deletions test/e2e/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/golang/glog"
)

Expand All @@ -32,12 +31,9 @@ func TestNetwork(c *client.Client) bool {
}

ns := api.NamespaceDefault
s := loadObjectOrDie(assetPath("contrib", "for-tests", "network-tester", "service.json")).(*api.Service)
// TODO(satnam6502): Replace call of randomSuffix with call to NewUUID when service
// names have the same form as pod and replication controller names.
s.Name += "-" + randomSuffix()
glog.Infof("Creating service with name %s", s.Name)
svc, err := c.Services(ns).Create(s)
svc, err := c.Services(ns).Create(loadObjectOrDie(assetPath(
"contrib", "for-tests", "network-tester", "service.json",
)).(*api.Service))
if err != nil {
glog.Errorf("unable to create test service: %v", err)
return false
Expand All @@ -49,9 +45,9 @@ func TestNetwork(c *client.Client) bool {
}
}()

r := loadObjectOrDie(assetPath("contrib", "for-tests", "network-tester", "rc.json")).(*api.ReplicationController)
r.Name += "-" + string(util.NewUUID())
rc, err := c.ReplicationControllers(ns).Create(r)
rc, err := c.ReplicationControllers(ns).Create(loadObjectOrDie(assetPath(
"contrib", "for-tests", "network-tester", "rc.json",
)).(*api.ReplicationController))
if err != nil {
glog.Errorf("unable to create test rc: %v", err)
return false
Expand All @@ -70,7 +66,7 @@ func TestNetwork(c *client.Client) bool {
}()
const maxAttempts = 60
for i := 0; i < maxAttempts; i++ {
time.Sleep(2 * time.Second)
time.Sleep(time.Second)
body, err := c.Get().Prefix("proxy").Resource("services").Name(svc.Name).Suffix("status").Do().Raw()
if err != nil {
glog.Infof("Attempt %v/%v: service/pod still starting. (error: '%v')", i, maxAttempts, err)
Expand Down
11 changes: 0 additions & 11 deletions test/e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ package e2e

import (
"io/ioutil"
"math/rand"
"path/filepath"
"strconv"
"time"

"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
Expand Down Expand Up @@ -185,12 +183,3 @@ func parseServiceOrDie(json string) *api.Service {
}
return service
}

// TODO: Allow service names to have the same form as names
// for pods and replication controllers so we don't
// need to use such a function and can instead
// use the UUID utilty function.
func randomSuffix() string {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
return strconv.Itoa(r.Int() % 10000)
}