Skip to content

Commit

Permalink
adding health check extension check
Browse files Browse the repository at this point in the history
  • Loading branch information
Paramadon committed Oct 16, 2024
1 parent 8168b43 commit 0177648
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/agent_otel_merging/agent_otel_merging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func TestOtelMerging(t *testing.T) {
appendOtelConfig(t)
sendPayload(t)
verifyMetricsInCloudWatch(t)
verifyHealthCheck(t)
}

func startAgent(t *testing.T) {
Expand Down Expand Up @@ -88,3 +89,14 @@ func verifyMetricsInCloudWatch(t *testing.T) {
require.NoError(t, err, "Failed to parse CloudWatch response")
require.NotEmpty(t, stats.Datapoints, "No data points found for the metric")
}

func verifyHealthCheck(t *testing.T) {
endpoint := "http://localhost:13133/health/status"

verifyCmd := exec.Command("curl", "-s", "-o", "/dev/null", "-w", "%{http_code}", endpoint)
verifyOutput, err := verifyCmd.CombinedOutput()
require.NoError(t, err, "Failed to execute curl command: %s", verifyOutput)

httpCode := string(verifyOutput)
require.Equal(t, "200", httpCode, "Expected HTTP status code 200, got %s", httpCode)
}
5 changes: 5 additions & 0 deletions test/agent_otel_merging/resources/otel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ exporters:
enabled: true
version: "0"

extensions:
health_check:

service:
extensions:
- health_check
pipelines:
metrics:
receivers: [otlp]
Expand Down

0 comments on commit 0177648

Please sign in to comment.