add TestStatus to instrumented_services_test
Change-Id: Ib2fafd714ed0a48a4dbb3b9fb406e516d5587ae4
This commit is contained in:
		| @@ -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) { | |||||||
| 	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) | ||||||
|  | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 chenguoyan01
					chenguoyan01