aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/api/instancehandler_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/k8splugin/api/instancehandler_test.go')
-rw-r--r--src/k8splugin/api/instancehandler_test.go85
1 files changed, 0 insertions, 85 deletions
diff --git a/src/k8splugin/api/instancehandler_test.go b/src/k8splugin/api/instancehandler_test.go
index 7b6594cf..c0690fb2 100644
--- a/src/k8splugin/api/instancehandler_test.go
+++ b/src/k8splugin/api/instancehandler_test.go
@@ -316,91 +316,6 @@ func TestInstanceGetHandler(t *testing.T) {
}
}
-func TestStatusHandler(t *testing.T) {
- testCases := []struct {
- label string
- input string
- expectedCode int
- expectedResponse *app.InstanceStatus
- instClient *mockInstanceClient
- }{
- {
- label: "Fail to Get Status",
- input: "HaKpys8e",
- expectedCode: http.StatusInternalServerError,
- instClient: &mockInstanceClient{
- err: pkgerrors.New("Internal error"),
- },
- },
- {
- label: "Succesful GET Status",
- input: "HaKpys8e",
- expectedCode: http.StatusOK,
- expectedResponse: &app.InstanceStatus{
- Request: app.InstanceRequest{
- RBName: "test-rbdef",
- RBVersion: "v1",
- ProfileName: "profile1",
- CloudRegion: "region1",
- },
- Ready: true,
- ResourceCount: 2,
- PodStatuses: []app.PodStatus{
- {
- Name: "test-pod1",
- Namespace: "default",
- Ready: true,
- IPAddresses: []string{"192.168.1.1", "192.168.2.1"},
- },
- {
- Name: "test-pod2",
- Namespace: "default",
- Ready: true,
- IPAddresses: []string{"192.168.3.1", "192.168.5.1"},
- },
- },
- },
- instClient: &mockInstanceClient{
- statusItem: app.InstanceStatus{
- Request: app.InstanceRequest{
- RBName: "test-rbdef",
- RBVersion: "v1",
- ProfileName: "profile1",
- CloudRegion: "region1",
- },
- Ready: true,
- ResourceCount: 2,
- PodStatuses: []app.PodStatus{
- {
- Name: "test-pod1",
- Namespace: "default",
- Ready: true,
- IPAddresses: []string{"192.168.1.1", "192.168.2.1"},
- },
- {
- Name: "test-pod2",
- Namespace: "default",
- Ready: true,
- IPAddresses: []string{"192.168.3.1", "192.168.5.1"},
- },
- },
- },
- },
- },
- }
-
- for _, testCase := range testCases {
- t.Run(testCase.label, func(t *testing.T) {
- request := httptest.NewRequest("GET", "/v1/instance/"+testCase.input+"/status", nil)
- resp := executeRequest(request, NewRouter(nil, nil, testCase.instClient, nil, nil, nil))
-
- if testCase.expectedCode != resp.StatusCode {
- t.Fatalf("Request method returned: %v and it was expected: %v", resp.StatusCode, testCase.expectedCode)
- }
- })
- }
-}
-
func TestInstanceListHandler(t *testing.T) {
testCases := []struct {
label string