18870: Need to declare NODES as array
[arvados.git] / services / keepstore / status_test.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 package keepstore
6
7 import (
8         "encoding/json"
9 )
10
11 // We don't have isolated unit tests for /status.json yet, but we do
12 // check (e.g., in pull_worker_test.go) that /status.json reports
13 // specific statistics correctly at the appropriate times.
14
15 // getStatusItem("foo","bar","baz") retrieves /status.json, decodes
16 // the response body into resp, and returns resp["foo"]["bar"]["baz"].
17 func getStatusItem(h *handler, keys ...string) interface{} {
18         resp := IssueRequest(h, &RequestTester{"/status.json", "", "GET", nil, ""})
19         var s interface{}
20         json.NewDecoder(resp.Body).Decode(&s)
21         for _, k := range keys {
22                 s = s.(map[string]interface{})[k]
23         }
24         return s
25 }