summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/api
diff options
context:
space:
mode:
authorKonrad Bańka <k.banka@samsung.com>2020-09-25 16:35:02 +0200
committerKonrad Bańka <k.banka@samsung.com>2020-09-30 12:56:34 +0200
commitb5ccaabd6c3b06286cc845bfb910fc2bd1ab6419 (patch)
tree3d8922fc3e7fa444a27d2b0fb81c220819f8c637 /src/k8splugin/api
parent603a68284970205fa95dec67d4f9b88ae99e8d2c (diff)
Fix Status API to actually provide instance status
Provide information about instance resources and Pods inside status response. Issue-ID: MULTICLOUD-1177 Signed-off-by: Konrad Bańka <k.banka@samsung.com> Change-Id: Iee6fd56120d091dddfa6b6d0e4aa7eb36d40e888
Diffstat (limited to 'src/k8splugin/api')
-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