cadvisor/integration/tests/healthz/healthz_test.go
Victor Marmol f6a90d7bac Adding integration test framework along with 3 tests.
These tests are similar to Go unit tests except that they're targetting
tesing of a running cAdvisor client. They do this by interacting with
the testing framework that is able to talk to the running cAdvisor. This
cAdvisor could be local or remote.
2014-11-19 13:02:24 -08:00

27 lines
495 B
Go

package healthz
import (
"io/ioutil"
"net/http"
"testing"
"github.com/google/cadvisor/integration/framework"
)
func TestHealthzOk(t *testing.T) {
fm := framework.New(t)
defer fm.Cleanup()
// Ensure that /heathz returns "ok"
resp, err := http.Get(fm.Host().FullHost() + "healthz")
if err != nil {
t.Fatal(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if string(body) != "ok" {
t.Fatalf("cAdvisor returned unexpected healthz status of %q", body)
}
}