add TestStatus to instrumented_services_test

Change-Id: Ib2fafd714ed0a48a4dbb3b9fb406e516d5587ae4
pull/6/head
chenguoyan01 2017-10-17 18:33:02 +08:00
parent b88cf9435e
commit 6a9070a59d
1 changed files with 25 additions and 3 deletions

View File

@ -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)
}