mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
simplified TestNewKubeletClient in kubelet_test
This commit is contained in:
parent
0f88d149cd
commit
50a6068b5d
@ -18,7 +18,6 @@ package client
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -27,6 +26,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/health"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -116,21 +116,21 @@ func TestNewKubeletClient(t *testing.T) {
|
|||||||
Port: 9000,
|
Port: 9000,
|
||||||
EnableHttps: false,
|
EnableHttps: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := NewKubeletClient(config)
|
client, err := NewKubeletClient(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Error %#v while trying to create a client.", err)
|
t.Errorf("Error while trying to create a client: %v", err)
|
||||||
|
}
|
||||||
|
if client == nil {
|
||||||
|
t.Error("client is nil.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if client == nil {
|
|
||||||
t.Errorf("%#v client is nil.", client)
|
|
||||||
}
|
|
||||||
host := "127.0.0.1"
|
host := "127.0.0.1"
|
||||||
healthStatus, err := client.HealthCheck(host)
|
healthStatus, err := client.HealthCheck(host)
|
||||||
if !(fmt.Sprintf("%v", healthStatus) == "unknown") {
|
if healthStatus != health.Unknown {
|
||||||
t.Errorf("Expected %v and got %v.", "unknown", healthStatus)
|
t.Errorf("Expected %v and got %v.", health.Unknown, healthStatus)
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Errorf("%#v", "Expected a non nil error")
|
t.Error("Expected a non nil error")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user