Commit 6a9070a5 authored by chenguoyan01's avatar chenguoyan01

add TestStatus to instrumented_services_test

Change-Id: Ib2fafd714ed0a48a4dbb3b9fb406e516d5587ae4
parent b88cf943
...@@ -17,13 +17,15 @@ limitations under the License. ...@@ -17,13 +17,15 @@ limitations under the License.
package kuberuntime package kuberuntime
import ( import (
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/assert"
"k8s.io/kubernetes/pkg/kubelet/metrics"
"net" "net"
"net/http" "net/http"
"testing" "testing"
"time" "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) { func TestRecordOperation(t *testing.T) {
...@@ -67,3 +69,23 @@ func TestInstrumentedVersion(t *testing.T) { ...@@ -67,3 +69,23 @@ func TestInstrumentedVersion(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, kubeRuntimeAPIVersion, vr.Version) 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)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment