Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate integration testing Dockefiles (postgres, redis) from TestUtils to github services #4502

Merged
merged 2 commits into from Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/integration-test.yml
Expand Up @@ -211,6 +211,16 @@ jobs:
image: quay.io/splunko11ytest/kong:latest
ports:
- "18001:8001"
postgres:
image: quay.io/splunko11ytest/postgres:latest
ports:
- "15432:5432"
redis_client:
image: quay.io/splunko11ytest/redis_client:latest
redis_server:
image: quay.io/splunko11ytest/redis_server:latest
ports:
- "6379:6379"
strategy:
matrix:
ARCH: [ "amd64", "arm64" ]
Expand Down
7 changes: 1 addition & 6 deletions tests/receivers/postgresql/postgresql_test.go
Expand Up @@ -18,21 +18,16 @@
package tests

import (
"path"
"testing"

"github.com/signalfx/splunk-otel-collector/tests/testutils"
)

var postgresqldb = []testutils.Container{testutils.NewContainer().WithContext(
path.Join(".", "testdata", "server"),
).WithName("postgresqldb").WithExposedPorts("15432:5432").WillWaitForLogs("database system is ready to accept connections")}

// This test ensures the collector can connect to a PostgreSQL DB, and properly get metrics. It's not intended to
// test the receiver itself.
func TestPostgresqlDBIntegration(t *testing.T) {
testutils.AssertAllMetricsReceived(t, "all.yaml", "all_metrics_config.yaml",
postgresqldb, []testutils.CollectorBuilder{
nil, []testutils.CollectorBuilder{
func(collector testutils.Collector) testutils.Collector {
return collector.WithEnv(map[string]string{
"POSTGRESQLDB_ENDPOINT": "localhost:15432",
Expand Down
10 changes: 2 additions & 8 deletions tests/receivers/redis/redisreceiver_test.go
Expand Up @@ -17,21 +17,15 @@
package tests

import (
"path"
"testing"

"github.com/signalfx/splunk-otel-collector/tests/testutils"
)

func TestRedisReceiverProvidesAllMetrics(t *testing.T) {
server := testutils.NewContainer().WithContext(path.Join(".", "testdata", "server")).WithExposedPorts("6379:6379").WithName("redis-server").WillWaitForPorts("6379").WillWaitForLogs("Ready to accept connections")
containers := []testutils.Container{server}
testutils.AssertAllMetricsReceived(t, "all.yaml", "all_metrics_config.yaml", containers, nil)
testutils.AssertAllMetricsReceived(t, "all.yaml", "all_metrics_config.yaml", nil, nil)
}

func TestRedisReceiverProvidesAllMetricsWithServer(t *testing.T) {
server := testutils.NewContainer().WithContext(path.Join(".", "testdata", "server")).WithExposedPorts("6379:6379").WithNetworks("redis_network").WithName("redis-server").WillWaitForLogs("Ready to accept connections")
client := testutils.NewContainer().WithContext(path.Join(".", "testdata", "client")).WithName("redis-client").WithNetworks("redis_network").WillWaitForLogs("redis client started")
containers := []testutils.Container{server, client}
testutils.AssertAllMetricsReceived(t, "all_server.yaml", "all_metrics_config.yaml", containers, nil)
testutils.AssertAllMetricsReceived(t, "all_server.yaml", "all_metrics_config.yaml", nil, nil)
}