Adding test to cover registerAdminArnsHandlers() (#1835)

This commit is contained in:
Cesar Celis Hernandez
2022-04-13 10:13:19 -04:00
committed by GitHub
parent 68f9019d0e
commit 5e10719168
2 changed files with 39 additions and 1 deletions

View File

@@ -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

View File

@@ -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,
)
}
}