Skip to content

Commit

Permalink
add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
grcevski committed Sep 27, 2024
1 parent f929005 commit 68f61c4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions test/integration/docker-compose-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ services:
image: ghcr.io/grafana/beyla-test/greeting-rails${TESTSERVER_IMAGE_SUFFIX}/0.0.1
ports:
- "${TEST_SERVICE_PORTS}"
environment:
OTEL_SERVICE_NAME: "my-ruby-app"
OTEL_RESOURCE_ATTRIBUTES: "data-center=ca,deployment-zone=to"
depends_on:
otelcol:
condition: service_started
Expand Down
16 changes: 14 additions & 2 deletions test/integration/red_test_ruby.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ func testREDMetricsForRubyHTTPLibrary(t *testing.T, url string, comm string) {
}
})

// check that the resource attributes we passed made it for the service
test.Eventually(t, testTimeout, func(t require.TestingT) {
var err error
results, err = pq.Query(`target_info{` +
`data_center="ca",` +
`deployment_zone="to"}`)
require.NoError(t, err)
enoughPromResults(t, results)
val := totalPromCount(t, results)
assert.LessOrEqual(t, 1, val)
})

// Call 4 times the instrumented service, forcing it to:
// - process multiple calls in a row with, one more than we might need
// - returning a 200 code
Expand Down Expand Up @@ -83,7 +95,7 @@ func testREDMetricsRailsHTTP(t *testing.T) {
} {
t.Run(testCaseURL, func(t *testing.T) {
waitForRubyTestComponents(t, testCaseURL)
testREDMetricsForRubyHTTPLibrary(t, testCaseURL, "ruby")
testREDMetricsForRubyHTTPLibrary(t, testCaseURL, "my-ruby-app")
})
}
}
Expand All @@ -94,7 +106,7 @@ func testREDMetricsRailsHTTPS(t *testing.T) {
} {
t.Run(testCaseURL, func(t *testing.T) {
waitForRubyTestComponents(t, testCaseURL)
testREDMetricsForRubyHTTPLibrary(t, testCaseURL, "ruby")
testREDMetricsForRubyHTTPLibrary(t, testCaseURL, "my-ruby-app")
})
}
}

0 comments on commit 68f61c4

Please sign in to comment.