Skip to content

Commit

Permalink
Migrate integration testing Dockefiles (postgres, redis) from TestUti…
Browse files Browse the repository at this point in the history
…ls to github services (#4502)

* Migrate integration testing postgres Dockefile from TestUtils to github services

* patch
  • Loading branch information
jvoravong committed Mar 21, 2024
1 parent 0d2250d commit 54004ab
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 14 deletions.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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)
}

0 comments on commit 54004ab

Please sign in to comment.