summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/api/instancehandler_test.go
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2021-08-01 21:01:44 +0200
committerLukasz Rajewski <lukasz.rajewski@orange.com>2021-08-02 22:48:48 +0200
commit5e27642926c9967a26eef5d4625aba2f1eee2c8c (patch)
tree9689affa97005d0eceb026432f6872744fcdc282 /src/k8splugin/api/instancehandler_test.go
parente42203ee6c170eebb9466ee82baa97f83e88955c (diff)
Add suport for query api on root level
Add suport for query api on root level. Instance query handler and root query handler merged. Issue-ID: MULTICLOUD-1379 Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com> Change-Id: I1dc95c7aca0e734edf5794e7c36143dc12070f2b
Diffstat (limited to 'src/k8splugin/api/instancehandler_test.go')
-rw-r--r--src/k8splugin/api/instancehandler_test.go22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/k8splugin/api/instancehandler_test.go b/src/k8splugin/api/instancehandler_test.go
index e05bd2d7..faec1329 100644
--- a/src/k8splugin/api/instancehandler_test.go
+++ b/src/k8splugin/api/instancehandler_test.go
@@ -205,7 +205,7 @@ func TestInstanceCreateHandler(t *testing.T) {
t.Run(testCase.label, func(t *testing.T) {
request := httptest.NewRequest("POST", "/v1/instance", testCase.input)
- resp := executeRequest(request, NewRouter(nil, nil, testCase.instClient, nil, nil, nil, nil))
+ resp := executeRequest(request, NewRouter(nil, nil, testCase.instClient, nil, nil, nil, nil, nil))
if testCase.expectedCode != resp.StatusCode {
body, _ := ioutil.ReadAll(resp.Body)
@@ -306,7 +306,7 @@ func TestInstanceGetHandler(t *testing.T) {
for _, testCase := range testCases {
t.Run(testCase.label, func(t *testing.T) {
request := httptest.NewRequest("GET", "/v1/instance/"+testCase.input, nil)
- resp := executeRequest(request, NewRouter(nil, nil, testCase.instClient, nil, nil, nil, nil))
+ resp := executeRequest(request, NewRouter(nil, nil, testCase.instClient, nil, nil, nil, nil, nil))
if testCase.expectedCode != resp.StatusCode {
t.Fatalf("Request method returned: %v and it was expected: %v",
@@ -441,7 +441,7 @@ func TestInstanceListHandler(t *testing.T) {
}
request.URL.RawQuery = q.Encode()
}
- resp := executeRequest(request, NewRouter(nil, nil, testCase.instClient, nil, nil, nil, nil))
+ resp := executeRequest(request, NewRouter(nil, nil, testCase.instClient, nil, nil, nil, nil, nil))
if testCase.expectedCode != resp.StatusCode {
t.Fatalf("Request method returned: %v and it was expected: %v",
@@ -500,7 +500,7 @@ func TestDeleteHandler(t *testing.T) {
for _, testCase := range testCases {
t.Run(testCase.label, func(t *testing.T) {
request := httptest.NewRequest("DELETE", "/v1/instance/"+testCase.input, nil)
- resp := executeRequest(request, NewRouter(nil, nil, testCase.instClient, nil, nil, nil, nil))
+ resp := executeRequest(request, NewRouter(nil, nil, testCase.instClient, nil, nil, nil, nil, nil))
if testCase.expectedCode != resp.StatusCode {
t.Fatalf("Request method returned: %v and it was expected: %v", resp.StatusCode, testCase.expectedCode)
@@ -539,18 +539,6 @@ func TestInstanceQueryHandler(t *testing.T) {
},
},
{
- label: "Missing name or label mandatory parameters",
- id: "HaKpys8e",
- input: map[string]string{
- "ApiVersion": "v1",
- "Kind": "Pod",
- },
- expectedCode: http.StatusBadRequest,
- instClient: &mockInstanceClient{
- err: pkgerrors.New("Name or Labels parameter must be provided"),
- },
- },
- {
label: "Query instance by name",
id: "HaKpys8e",
input: map[string]string{
@@ -746,7 +734,7 @@ func TestInstanceQueryHandler(t *testing.T) {
}
url := "/v1/instance/" + testCase.id + "/query?" + params.Encode()
request := httptest.NewRequest("GET", url, nil)
- resp := executeRequest(request, NewRouter(nil, nil, testCase.instClient, nil, nil, nil, nil))
+ resp := executeRequest(request, NewRouter(nil, nil, testCase.instClient, nil, nil, nil, nil, nil))
if testCase.expectedCode != resp.StatusCode {
body, _ := ioutil.ReadAll(resp.Body)