mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Merge pull request #3766 from GoogleCloudPlatform/revert-3749-network
Revert "Allow network end-to-end test to be run in parallel"
This commit is contained in:
commit
3a06802e0f
@ -21,7 +21,6 @@ import (
|
|||||||
|
|
||||||
"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/GoogleCloudPlatform/kubernetes/pkg/util"
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,12 +31,9 @@ func TestNetwork(c *client.Client) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ns := api.NamespaceDefault
|
ns := api.NamespaceDefault
|
||||||
s := loadObjectOrDie(assetPath("contrib", "for-tests", "network-tester", "service.json")).(*api.Service)
|
svc, err := c.Services(ns).Create(loadObjectOrDie(assetPath(
|
||||||
// TODO(satnam6502): Replace call of randomSuffix with call to NewUUID when service
|
"contrib", "for-tests", "network-tester", "service.json",
|
||||||
// names have the same form as pod and replication controller names.
|
)).(*api.Service))
|
||||||
s.Name += "-" + randomSuffix()
|
|
||||||
glog.Infof("Creating service with name %s", s.Name)
|
|
||||||
svc, err := c.Services(ns).Create(s)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("unable to create test service: %v", err)
|
glog.Errorf("unable to create test service: %v", err)
|
||||||
return false
|
return false
|
||||||
@ -49,9 +45,9 @@ func TestNetwork(c *client.Client) bool {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
r := loadObjectOrDie(assetPath("contrib", "for-tests", "network-tester", "rc.json")).(*api.ReplicationController)
|
rc, err := c.ReplicationControllers(ns).Create(loadObjectOrDie(assetPath(
|
||||||
r.Name += "-" + string(util.NewUUID())
|
"contrib", "for-tests", "network-tester", "rc.json",
|
||||||
rc, err := c.ReplicationControllers(ns).Create(r)
|
)).(*api.ReplicationController))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("unable to create test rc: %v", err)
|
glog.Errorf("unable to create test rc: %v", err)
|
||||||
return false
|
return false
|
||||||
@ -70,7 +66,7 @@ func TestNetwork(c *client.Client) bool {
|
|||||||
}()
|
}()
|
||||||
const maxAttempts = 60
|
const maxAttempts = 60
|
||||||
for i := 0; i < maxAttempts; i++ {
|
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()
|
body, err := c.Get().Prefix("proxy").Resource("services").Name(svc.Name).Suffix("status").Do().Raw()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Infof("Attempt %v/%v: service/pod still starting. (error: '%v')", i, maxAttempts, err)
|
glog.Infof("Attempt %v/%v: service/pod still starting. (error: '%v')", i, maxAttempts, err)
|
||||||
|
@ -18,9 +18,7 @@ package e2e
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math/rand"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
@ -185,12 +183,3 @@ func parseServiceOrDie(json string) *api.Service {
|
|||||||
}
|
}
|
||||||
return 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)
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user