(ipAddress, portStr string)
| 53 | var retryRegex *regexp.Regexp |
| 54 | |
| 55 | func getAttributes(ipAddress, portStr string) (*cadvisorApi.Attributes, error) { |
| 56 | // Get host attributes and log attributes if the tests fail. |
| 57 | var attributes cadvisorApi.Attributes |
| 58 | resp, err := http.Get(fmt.Sprintf("http://%s:%s/api/v2.1/attributes", ipAddress, portStr)) |
| 59 | if err != nil { |
| 60 | return nil, fmt.Errorf("failed to get attributes - %v", err) |
| 61 | } |
| 62 | if resp.StatusCode != http.StatusOK { |
| 63 | return nil, fmt.Errorf("failed to get attributes. Status code - %v", resp.StatusCode) |
| 64 | } |
| 65 | defer resp.Body.Close() |
| 66 | body, err := io.ReadAll(resp.Body) |
| 67 | if err != nil { |
| 68 | return nil, fmt.Errorf("unable to read attributes response body - %v", err) |
| 69 | } |
| 70 | if err := json.Unmarshal(body, &attributes); err != nil { |
| 71 | return nil, fmt.Errorf("failed to unmarshal attributes - %v", err) |
| 72 | } |
| 73 | return &attributes, nil |
| 74 | } |
| 75 | |
| 76 | func RunCommand(cmd string, args ...string) error { |
| 77 | output, err := exec.Command(cmd, args...).CombinedOutput() |
no test coverage detected
searching dependent graphs…