зеркало из https://github.com/golang/build.git
kubernetes: fix, test GetNodes
Broken in my cleanup golang.org/cl/36692 Change-Id: I5f82314b8ff703cf2c894771fbc0eb16834fc47b Reviewed-on: https://go-review.googlesource.com/37216 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Родитель
b8aa0be147
Коммит
c5562d003a
|
@ -429,7 +429,7 @@ func (c *Client) PodLog(ctx context.Context, podName string) (string, error) {
|
|||
// PodNodes returns the list of nodes that comprise the Kubernetes cluster
|
||||
func (c *Client) GetNodes(ctx context.Context) ([]api.Node, error) {
|
||||
var list api.NodeList
|
||||
if err := c.do(ctx, "GET", c.nsEndpoint()+"nodes", &list); err != nil {
|
||||
if err := c.do(ctx, "GET", c.endpointURL+"/nodes", &list); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return list.Items, nil
|
||||
|
|
|
@ -150,3 +150,19 @@ func foreachCluster(t *testing.T, fn func(*container.Cluster, *kubernetes.Client
|
|||
kc.Close()
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetNodes(t *testing.T) {
|
||||
var passed bool
|
||||
ctx := context.Background()
|
||||
foreachCluster(t, func(cl *container.Cluster, kc *kubernetes.Client) {
|
||||
if passed {
|
||||
return
|
||||
}
|
||||
nodes, err := kc.GetNodes(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Logf("%d nodes in cluster %s", len(nodes), cl.Name)
|
||||
passed = true
|
||||
})
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче