From acdc45628f78411c4f86f4799ebe6877bc90f77f Mon Sep 17 00:00:00 2001 From: tanshanshan Date: Thu, 27 Sep 2018 08:33:27 +0800 Subject: [PATCH] use http.StatusOK instead of 200 --- test/integration/master/kube_apiserver_test.go | 5 +++-- test/integration/metrics/metrics_test.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/integration/master/kube_apiserver_test.go b/test/integration/master/kube_apiserver_test.go index 187b1da1b00..050b2f75844 100644 --- a/test/integration/master/kube_apiserver_test.go +++ b/test/integration/master/kube_apiserver_test.go @@ -19,6 +19,7 @@ package master import ( "encoding/json" "fmt" + "net/http" "reflect" "strings" "testing" @@ -98,8 +99,8 @@ func TestOpenAPIDelegationChainPlumbing(t *testing.T) { result := kubeclient.RESTClient().Get().AbsPath("/swagger.json").Do() status := 0 result.StatusCode(&status) - if status != 200 { - t.Fatalf("GET /swagger.json failed: expected status=%d, got=%d", 200, status) + if status != http.StatusOK { + t.Fatalf("GET /swagger.json failed: expected status=%d, got=%d", http.StatusOK, status) } raw, err := result.Raw() diff --git a/test/integration/metrics/metrics_test.go b/test/integration/metrics/metrics_test.go index 9b4391f5a62..9269f7ba4e1 100644 --- a/test/integration/metrics/metrics_test.go +++ b/test/integration/metrics/metrics_test.go @@ -54,7 +54,7 @@ func scrapeMetrics(s *httptest.Server) ([]*prometheuspb.MetricFamily, error) { return nil, fmt.Errorf("Unable to contact metrics endpoint of master: %v", err) } defer resp.Body.Close() - if resp.StatusCode != 200 { + if resp.StatusCode != http.StatusOK { return nil, fmt.Errorf("Non-200 response trying to scrape metrics from master: %v", resp) }