Adjust the import package order and use http library variables (#9587)
Signed-off-by: Fish-pro <zechun.chen@daocloud.io>
This commit is contained in:
parent
fbdbc24a42
commit
1cdd61fb94
6 changed files with 7 additions and 7 deletions
|
@ -122,7 +122,7 @@ func TestNginxCheck(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func callHealthz(expErr bool, healthzPath string, mux *http.ServeMux) error {
|
func callHealthz(expErr bool, healthzPath string, mux *http.ServeMux) error {
|
||||||
req, err := http.NewRequest("GET", healthzPath, nil)
|
req, err := http.NewRequest(http.MethodGet, healthzPath, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("healthz error: %v", err)
|
return fmt.Errorf("healthz error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ func TestConfigureDynamically(t *testing.T) {
|
||||||
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusCreated)
|
w.WriteHeader(http.StatusCreated)
|
||||||
|
|
||||||
if r.Method != "POST" {
|
if r.Method != http.MethodPost {
|
||||||
t.Errorf("expected a 'POST' request, got '%s'", r.Method)
|
t.Errorf("expected a 'POST' request, got '%s'", r.Method)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ func TestConfigureCertificates(t *testing.T) {
|
||||||
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusCreated)
|
w.WriteHeader(http.StatusCreated)
|
||||||
|
|
||||||
if r.Method != "POST" {
|
if r.Method != http.MethodPost {
|
||||||
t.Errorf("expected a 'POST' request, got '%s'", r.Method)
|
t.Errorf("expected a 'POST' request, got '%s'", r.Method)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ package status
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
v1 "k8s.io/api/networking/v1"
|
|
||||||
"net"
|
"net"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
|
@ -30,6 +29,7 @@ import (
|
||||||
|
|
||||||
pool "gopkg.in/go-playground/pool.v3"
|
pool "gopkg.in/go-playground/pool.v3"
|
||||||
apiv1 "k8s.io/api/core/v1"
|
apiv1 "k8s.io/api/core/v1"
|
||||||
|
v1 "k8s.io/api/networking/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
|
|
|
@ -26,7 +26,7 @@ func (f *Framework) VerifyHealthz(ip string, statusCode int) error {
|
||||||
url := fmt.Sprintf("http://%v:10254/healthz", ip)
|
url := fmt.Sprintf("http://%v:10254/healthz", ip)
|
||||||
|
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
req, err := http.NewRequest("GET", url, nil)
|
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("creating GET request for URL %q failed: %v", url, err)
|
return fmt.Errorf("creating GET request for URL %q failed: %v", url, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ func (f *Framework) GetMetric(metricName, ip string) (*dto.MetricFamily, error)
|
||||||
url := fmt.Sprintf("http://%v:10254/metrics", ip)
|
url := fmt.Sprintf("http://%v:10254/metrics", ip)
|
||||||
|
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
req, err := http.NewRequest("GET", url, nil)
|
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("creating GET request for URL %q failed: %v", url, err)
|
return nil, fmt.Errorf("creating GET request for URL %q failed: %v", url, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ package settings
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
v1 "k8s.io/api/networking/v1"
|
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -29,6 +28,7 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
|
v1 "k8s.io/api/networking/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue