Fix taskmetadata validator test
@@ -100,6 +100,8 @@ func taskMetadata(client *http.Client) (*TaskResponse, error) {
return nil, err
}
+ fmt.Printf("Received task metadata: %s \n", string(body))
+
var taskMetadata TaskResponse
err = json.Unmarshal(body, &taskMetadata)
if err != nil {
@@ -115,7 +117,7 @@ func containerMetadata(client *http.Client, id string) (*ContainerResponse, erro
return nil, err
}
- fmt.Println("Received data: %s ", string(body))
+ fmt.Printf("Received container metadata: %s \n", string(body))
var containerMetadata ContainerResponse
err = json.Unmarshal(body, &containerMetadata)
@@ -132,6 +134,8 @@ func taskStats(client *http.Client) (map[string]*docker.Stats, error) {
return nil, err
}
+ fmt.Printf("Received task stats: %s \n", string(body))
+
var taskStats map[string]*docker.Stats
err = json.Unmarshal(body, &taskStats)
if err != nil {
@@ -147,6 +151,8 @@ func containerStats(client *http.Client, id string) (*docker.Stats, error) {
return nil, err
}
+ fmt.Printf("Received container stats: %s \n", string(body))
+
var containerStats docker.Stats
err = json.Unmarshal(body, &containerStats)
if err != nil {
@@ -228,10 +234,11 @@ func main() {
os.Exit(1)
}
+ if containerMetadata.Health.Status != "" { // if the health status is available
if containerMetadata.Health.Status != "HEALTHY" || containerMetadata.Health.Output != "hello\n" {
fmt.Fprintf(os.Stderr, "Container health metadata unexpected, got: %s\n", containerMetadata.Health)
- // TODO uncomment this when the container health check is deployed in backend
- // os.Exit(1)
+ os.Exit(1)
+ }
}
_, err = taskStats(client)
