Adding test to cover registerAdminArnsHandlers() (#1835)
This commit is contained in:
committed by
GitHub
parent
68f9019d0e
commit
5e10719168
2
.github/workflows/jobs.yaml
vendored
2
.github/workflows/jobs.yaml
vendored
@@ -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
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user