- }
-
- return pullRequest
-}
-
-func GetKeepServices(t *testing.T) []string {
- client := &http.Client{Transport: &http.Transport{
- TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}}
-
- req, err := http.NewRequest("GET", fmt.Sprintf("https://%s/arvados/v1/keep_services", os.Getenv("ARVADOS_API_HOST")), nil)
- if err != nil {
- t.Errorf("Error getting keep services: ", err)
- }
- req.Header.Set("Authorization", fmt.Sprintf("OAuth2 %s", os.Getenv("ARVADOS_API_TOKEN")))
-
- resp, err := client.Do(req)
- if err != nil {
- t.Errorf("Error getting keep services: ", err)
- }
- if resp.StatusCode != 200 {
- t.Errorf("Error status code getting keep services", resp.StatusCode)
- }
-
- defer resp.Body.Close()
- var servers []string
-
- decoder := json.NewDecoder(resp.Body)
-
- var respJSON map[string]interface{}
- err = decoder.Decode(&respJSON)
- if err != nil {
- t.Errorf("Error decoding response for keep services: ", err)
- }
-
- var service_names []string
- var service_ports []string
- for _, v1 := range respJSON {
- switch v1_type := v1.(type) {
- case []interface{}:
- for _, v2 := range v1_type {
- switch v2_type := v2.(type) {
- case map[string]interface{}:
- for name, value := range v2_type {
- if name == "service_host" {
- service_names = append(service_names, fmt.Sprintf("%s", value))
- } else if name == "service_port" {
- service_ports = append(service_ports, strings.Split(fmt.Sprintf("%f", value), ".")[0])
- }
- }
- default:
- }
- }
- default: