Merge pull request #69124 from tanshanshan/httpcode

replace 200 with http.StatusOK
pull/58/head
k8s-ci-robot 2018-09-27 09:51:48 -07:00 committed by GitHub
commit 0787715978
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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()

View File

@ -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)
}