From 5e10719168b14f65bda598b9921409c965c3bf96 Mon Sep 17 00:00:00 2001 From: Cesar Celis Hernandez Date: Wed, 13 Apr 2022 10:13:19 -0400 Subject: [PATCH] Adding test to cover registerAdminArnsHandlers() (#1835) --- .github/workflows/jobs.yaml | 2 +- integration/admin_api_integration_test.go | 38 +++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/.github/workflows/jobs.yaml b/.github/workflows/jobs.yaml index ef5256c39..4a953e97c 100644 --- a/.github/workflows/jobs.yaml +++ b/.github/workflows/jobs.yaml @@ -1142,7 +1142,7 @@ jobs: result=${result%\%} echo "result:" echo $result - threshold=35.40 + threshold=35.60 if (( $(echo "$result >= $threshold" |bc -l) )); then echo "It is equal or greater than threshold, passed!" else diff --git a/integration/admin_api_integration_test.go b/integration/admin_api_integration_test.go index 6dadda260..ac53fe191 100644 --- a/integration/admin_api_integration_test.go +++ b/integration/admin_api_integration_test.go @@ -300,3 +300,41 @@ func TestGetNodes(t *testing.T) { } } + +func ArnList() (*http.Response, error) { + /* + Helper function to get arn list + HTTP Verb: GET + URL: /api/v1/admin/arns + */ + request, err := http.NewRequest( + "GET", "http://localhost:9090/api/v1/admin/arns", nil) + if err != nil { + log.Println(err) + } + request.Header.Add("Cookie", fmt.Sprintf("token=%s", token)) + request.Header.Add("Content-Type", "application/json") + client := &http.Client{ + Timeout: 2 * time.Second, + } + response, err := client.Do(request) + return response, err +} + +func TestArnList(t *testing.T) { + assert := assert.New(t) + resp, err := ArnList() + assert.Nil(err) + if err != nil { + log.Println(err) + return + } + objRsp := inspectHTTPResponse(resp) + if resp != nil { + assert.Equal( + 200, + resp.StatusCode, + objRsp, + ) + } +}