mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #69124 from tanshanshan/httpcode
replace 200 with http.StatusOK
This commit is contained in:
commit
0787715978
@ -19,6 +19,7 @@ package master
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@ -98,8 +99,8 @@ func TestOpenAPIDelegationChainPlumbing(t *testing.T) {
|
|||||||
result := kubeclient.RESTClient().Get().AbsPath("/swagger.json").Do()
|
result := kubeclient.RESTClient().Get().AbsPath("/swagger.json").Do()
|
||||||
status := 0
|
status := 0
|
||||||
result.StatusCode(&status)
|
result.StatusCode(&status)
|
||||||
if status != 200 {
|
if status != http.StatusOK {
|
||||||
t.Fatalf("GET /swagger.json failed: expected status=%d, got=%d", 200, status)
|
t.Fatalf("GET /swagger.json failed: expected status=%d, got=%d", http.StatusOK, status)
|
||||||
}
|
}
|
||||||
|
|
||||||
raw, err := result.Raw()
|
raw, err := result.Raw()
|
||||||
|
@ -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)
|
return nil, fmt.Errorf("Unable to contact metrics endpoint of master: %v", err)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
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)
|
return nil, fmt.Errorf("Non-200 response trying to scrape metrics from master: %v", resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user