Skip to content

Commit

Permalink
Add workaround for different output on different CI's
Browse files Browse the repository at this point in the history
See comment, GHA nodes behave different to Apache CI.
Temporary workaround for this
  • Loading branch information
domhanak committed Feb 8, 2024
1 parent 07e6663 commit 60acc05
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/e2e/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,15 @@ func getHealthStatusInContainer(podName string, containerName string, ns string)
cmd := exec.Command("kubectl", "exec", "-t", podName, "-n", ns, "-c", containerName, "--", "curl", "-s", "localhost:8080/q/health")
output, err := utils.Run(cmd)
Expect(err).NotTo(HaveOccurred())
// On Apache CI Nodes, does not return valid JSON, hence we match first and last brackets by index and extract it
stringOutput := string(output)
startIndex := strings.Index(stringOutput, "{")
endIndex := strings.LastIndex(stringOutput, "}")
stringOutput = stringOutput[startIndex-1:endIndex+1]
if (startIndex == 0) {
stringOutput = stringOutput[startIndex:endIndex+1]
} else {
stringOutput = stringOutput[startIndex-1:endIndex+1]
}
fmt.Printf("Parsed following JSON object from health Endpoint response: %v\n", stringOutput)
err = json.Unmarshal([]byte(stringOutput), &h)
if err != nil {
Expand Down

0 comments on commit 60acc05

Please sign in to comment.