mirror of https://github.com/k3s-io/k3s
add TestStatus to instrumented_services_test
Change-Id: Ib2fafd714ed0a48a4dbb3b9fb406e516d5587ae4pull/6/head
parent
b88cf9435e
commit
6a9070a59d
|
@ -17,13 +17,15 @@ limitations under the License.
|
|||
package kuberuntime
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"k8s.io/kubernetes/pkg/kubelet/metrics"
|
||||
"net"
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/stretchr/testify/assert"
|
||||
runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
||||
"k8s.io/kubernetes/pkg/kubelet/metrics"
|
||||
)
|
||||
|
||||
func TestRecordOperation(t *testing.T) {
|
||||
|
@ -67,3 +69,23 @@ func TestInstrumentedVersion(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.Equal(t, kubeRuntimeAPIVersion, vr.Version)
|
||||
}
|
||||
|
||||
func TestStatus(t *testing.T) {
|
||||
fakeRuntime, _, _, _ := createTestRuntimeManager()
|
||||
fakeRuntime.FakeStatus = &runtimeapi.RuntimeStatus{
|
||||
Conditions: []*runtimeapi.RuntimeCondition{
|
||||
{Type: runtimeapi.RuntimeReady, Status: false},
|
||||
{Type: runtimeapi.NetworkReady, Status: true},
|
||||
},
|
||||
}
|
||||
irs := newInstrumentedRuntimeService(fakeRuntime)
|
||||
actural, err := irs.Status()
|
||||
assert.NoError(t, err)
|
||||
expected := &runtimeapi.RuntimeStatus{
|
||||
Conditions: []*runtimeapi.RuntimeCondition{
|
||||
{Type: runtimeapi.RuntimeReady, Status: false},
|
||||
{Type: runtimeapi.NetworkReady, Status: true},
|
||||
},
|
||||
}
|
||||
assert.Equal(t, expected, actural)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue