Esempio n. 1
0
func curlServiceNodePort(client *client.Client, ns, name string, port int) error {
	// TODO: Curl all nodes?
	u, err := framework.GetNodePortURL(client, ns, name, port)
	if err != nil {
		return err
	}
	var svcCurlBody string
	timeout := 30 * time.Second
	pollErr := wait.Poll(10*time.Second, timeout, func() (bool, error) {
		svcCurlBody, err = simpleGET(timeoutClient, u, "")
		if err != nil {
			framework.Logf("Failed to curl service node port, body: %v\nerror %v", svcCurlBody, err)
			return false, nil
		}
		return true, nil
	})
	if pollErr != nil {
		return fmt.Errorf("Failed to curl service node port in %v, body: %v\nerror %v", timeout, svcCurlBody, err)
	}
	framework.Logf("Successfully curled service node port, body: %v", svcCurlBody)
	return nil
}
Esempio n. 2
0
func (j *testJig) curlServiceNodePort(ns, name string, port int) {
	// TODO: Curl all nodes?
	u, err := framework.GetNodePortURL(j.client, ns, name, port)
	framework.ExpectNoError(err)
	framework.ExpectNoError(pollURL(u, "", 30*time.Second, j.pollInterval, &http.Client{Timeout: reqTimeout}, false))
}