mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #2787 from rajdeepd/master
Added two test cases for KubeletClient
This commit is contained in:
commit
e8280364fc
@ -18,6 +18,7 @@ package client
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
@ -109,3 +110,27 @@ func TestHTTPKubeletClientNotFound(t *testing.T) {
|
||||
t.Errorf("Expected %#v, Got %#v", ErrPodInfoNotAvailable, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewKubeletClient(t *testing.T) {
|
||||
config := &KubeletConfig{
|
||||
Port: 9000,
|
||||
EnableHttps: false,
|
||||
}
|
||||
client, err := NewKubeletClient(config)
|
||||
if err != nil {
|
||||
t.Errorf("Error %#v while trying to create a client.", err)
|
||||
}
|
||||
|
||||
if client == nil {
|
||||
t.Errorf("%#v client is nil.", client)
|
||||
}
|
||||
host := "127.0.0.1"
|
||||
healthStatus, err := client.HealthCheck(host)
|
||||
if !(fmt.Sprintf("%v", healthStatus) == "unknown") {
|
||||
t.Errorf("Expected %v and got %v.", "unknown", healthStatus)
|
||||
}
|
||||
if err == nil {
|
||||
t.Errorf("%#v", "Expected a non nil error")
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user