MCPcopy
hub / github.com/google/cadvisor / getAttributes

Function getAttributes

integration/runner/runner.go:55–74  ·  view source on GitHub ↗
(ipAddress, portStr string)

Source from the content-addressed store, hash-verified

53var retryRegex *regexp.Regexp
54
55func 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
76func RunCommand(cmd string, args ...string) error {
77 output, err := exec.Command(cmd, args...).CombinedOutput()

Callers 1

PushAndRunTestsFunction · 0.85

Calls 3

ErrorfMethod · 0.80
GetMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…