Skip to content

Commit

Permalink
chore: run ddapm-test-agent in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
rarguelloF committed Sep 23, 2024
1 parent 1d46913 commit d7d2d49
Show file tree
Hide file tree
Showing 20 changed files with 144 additions and 244 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,6 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: "**/go.mod"
- name: Setup python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
with:
python-version: 3.x
cache: pip
cache-dependency-path: _integration-tests/utils/agent/requirements.txt
- name: Install python dependencies
run: pip install -r _integration-tests/utils/agent/requirements.txt
- name: Build orchestrion binary
shell: bash
run: |-
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/workflow_call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,6 @@ jobs:
with:
go-version: stable
cache-dependency-path: "**/go.mod"
- name: Setup python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
with:
python-version: 3.x
cache: pip
cache-dependency-path: orchestrion/_integration-tests/utils/agent/requirements.txt
- name: Install python dependencies
run: pip install -r orchestrion/_integration-tests/utils/agent/requirements.txt
- name: Build orchestrion binary
run: go -C orchestrion/ build -o="./_integration-tests/orchestrion.exe" .
- name: Run Integration Tests
Expand Down
9 changes: 1 addition & 8 deletions _integration-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@ Each test is a directory within the `tests` directory. This directory must conta
## Running Tests Locally

Tests can be run locally with `go test`, using Orchestrion.
First, install the `ddapm-test-agent` if you haven't already:

``` console
$ python3 -m venv venv
$ source ./venv/bin/activate
$ pip install -r ./utils/agent/requirements.txt
```

Then, ensure that Docker is installed and the daemon is running.
First, ensure that Docker is installed and the daemon is running.

Then, compile Orchestrion and use it to run the tests:

Expand Down
4 changes: 2 additions & 2 deletions _integration-tests/tests/aws.v1/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"

"orchestrion/integration/utils"
testcontainersutils "orchestrion/integration/utils/testcontainers"
"orchestrion/integration/validator/trace"
)

Expand All @@ -30,7 +30,7 @@ type TestCase struct {
}

func (tc *TestCase) Setup(t *testing.T) {
server, host, port := utils.StartDynamoDBTestContainer(t)
server, host, port := testcontainersutils.StartDynamoDBTestContainer(t)
tc.server = server

tc.cfg = &aws.Config{
Expand Down
4 changes: 2 additions & 2 deletions _integration-tests/tests/aws.v2/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"

"orchestrion/integration/utils"
testcontainersutils "orchestrion/integration/utils/testcontainers"
"orchestrion/integration/validator/trace"
)

Expand All @@ -30,7 +30,7 @@ type base struct {
}

func (b *base) setup(t *testing.T) {
b.server, b.host, b.port = utils.StartDynamoDBTestContainer(t)
b.server, b.host, b.port = testcontainersutils.StartDynamoDBTestContainer(t)
}

func (b *base) teardown(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions _integration-tests/tests/gcp_pubsub/gcp_pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

"orchestrion/integration/utils"
testcontainersutils "orchestrion/integration/utils/testcontainers"
"orchestrion/integration/validator/trace"
)

Expand All @@ -47,9 +47,9 @@ func (tc *TestCase) Setup(t *testing.T) {
"gcr.io/google.com/cloudsdktool/cloud-sdk:490.0.0-emulators",
gcloud.WithProjectID("pstest-orchestrion"),
testcontainers.WithLogger(testcontainers.TestLogger(t)),
utils.WithTestLogConsumer(t),
testcontainersutils.WithTestLogConsumer(t),
)
utils.AssertTestContainersError(t, err)
testcontainersutils.AssertError(t, err)

projectID := tc.container.Settings.ProjectID

Expand Down
10 changes: 5 additions & 5 deletions _integration-tests/tests/go-redis.v7/go-redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ import (
"context"
"log"
"net/url"
"orchestrion/integration/utils"
"orchestrion/integration/validator/trace"
"testing"
"time"

"github.com/go-redis/redis/v7"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"
testredis "github.com/testcontainers/testcontainers-go/modules/redis"
"github.com/testcontainers/testcontainers-go/wait"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"

"github.com/go-redis/redis/v7"
testcontainersutils "orchestrion/integration/utils/testcontainers"
"orchestrion/integration/validator/trace"
)

type TestCase struct {
Expand All @@ -38,7 +38,7 @@ func (tc *TestCase) Setup(t *testing.T) {
tc.server, err = testredis.Run(ctx,
"redis:7",
testcontainers.WithLogger(testcontainers.TestLogger(t)),
utils.WithTestLogConsumer(t),
testcontainersutils.WithTestLogConsumer(t),
testcontainers.WithWaitStrategy(
wait.ForAll(
wait.ForLog("* Ready to accept connections"),
Expand All @@ -47,7 +47,7 @@ func (tc *TestCase) Setup(t *testing.T) {
),
),
)
utils.AssertTestContainersError(t, err)
testcontainersutils.AssertError(t, err)

redisURI, err := tc.server.ConnectionString(ctx)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions _integration-tests/tests/go-redis.v8/go-redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ import (
"context"
"log"
"net/url"
"orchestrion/integration/utils"
"orchestrion/integration/validator/trace"
"testing"
"time"

"github.com/go-redis/redis/v8"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"
testredis "github.com/testcontainers/testcontainers-go/modules/redis"
"github.com/testcontainers/testcontainers-go/wait"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"

"github.com/go-redis/redis/v8"
testcontainersutils "orchestrion/integration/utils/testcontainers"
"orchestrion/integration/validator/trace"
)

type TestCase struct {
Expand All @@ -38,7 +38,7 @@ func (tc *TestCase) Setup(t *testing.T) {
tc.server, err = testredis.Run(ctx,
"redis:7",
testcontainers.WithLogger(testcontainers.TestLogger(t)),
utils.WithTestLogConsumer(t),
testcontainersutils.WithTestLogConsumer(t),
testcontainers.WithWaitStrategy(
wait.ForAll(
wait.ForLog("* Ready to accept connections"),
Expand All @@ -47,7 +47,7 @@ func (tc *TestCase) Setup(t *testing.T) {
),
),
)
utils.AssertTestContainersError(t, err)
testcontainersutils.AssertError(t, err)

redisURI, err := tc.server.ConnectionString(ctx)
if err != nil {
Expand Down
7 changes: 4 additions & 3 deletions _integration-tests/tests/go-redis.v9/go-redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"context"
"log"
"net/url"
"orchestrion/integration/utils"
"orchestrion/integration/validator/trace"
"testing"
"time"

Expand All @@ -23,6 +21,9 @@ import (
testredis "github.com/testcontainers/testcontainers-go/modules/redis"
"github.com/testcontainers/testcontainers-go/wait"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"

testcontainersutils "orchestrion/integration/utils/testcontainers"
"orchestrion/integration/validator/trace"
)

type TestCase struct {
Expand All @@ -37,7 +38,7 @@ func (tc *TestCase) Setup(t *testing.T) {
tc.server, err = testredis.Run(ctx,
"redis:7",
testcontainers.WithLogger(testcontainers.TestLogger(t)),
utils.WithTestLogConsumer(t),
testcontainersutils.WithTestLogConsumer(t),
testcontainers.WithWaitStrategy(
wait.ForAll(
wait.ForLog("* Ready to accept connections"),
Expand Down
6 changes: 3 additions & 3 deletions _integration-tests/tests/gocql/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
testcassandra "github.com/testcontainers/testcontainers-go/modules/cassandra"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"

"orchestrion/integration/utils"
testcontainersutils "orchestrion/integration/utils/testcontainers"
"orchestrion/integration/validator/trace"
)

Expand All @@ -38,9 +38,9 @@ func (b *base) setup(t *testing.T) {
b.container, err = testcassandra.Run(ctx,
"cassandra:4.1",
testcontainers.WithLogger(testcontainers.TestLogger(t)),
utils.WithTestLogConsumer(t),
testcontainersutils.WithTestLogConsumer(t),
)
utils.AssertTestContainersError(t, err)
testcontainersutils.AssertError(t, err)

b.hostPort, err = b.container.ConnectionHost(ctx)
require.NoError(t, err)
Expand Down
10 changes: 5 additions & 5 deletions _integration-tests/tests/ibm_sarama/ibm_sarama.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import (
"testing"
"time"

"orchestrion/integration/utils"
"orchestrion/integration/validator/trace"

"github.com/IBM/sarama"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/redpanda"

testcontainersutils "orchestrion/integration/utils/testcontainers"
"orchestrion/integration/validator/trace"
)

const (
Expand All @@ -47,9 +47,9 @@ func (tc *TestCase) Setup(t *testing.T) {
"docker.redpanda.com/redpandadata/redpanda:v24.2.1",
redpanda.WithAutoCreateTopics(),
testcontainers.WithLogger(testcontainers.TestLogger(t)),
utils.WithTestLogConsumer(t),
testcontainersutils.WithTestLogConsumer(t),
)
utils.AssertTestContainersError(t, err)
testcontainersutils.AssertError(t, err)

addr, err := tc.server.KafkaSeedBroker(ctx)
require.NoError(t, err, "failed to get seed broker address")
Expand Down
12 changes: 6 additions & 6 deletions _integration-tests/tests/mongo/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ import (
"context"
"log"
"net/url"
"orchestrion/integration/utils"
"orchestrion/integration/validator/trace"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"
testmongo "github.com/testcontainers/testcontainers-go/modules/mongodb"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"

testcontainersutils "orchestrion/integration/utils/testcontainers"
"orchestrion/integration/validator/trace"
)

type TestCase struct {
Expand All @@ -39,9 +39,9 @@ func (tc *TestCase) Setup(t *testing.T) {
tc.server, err = testmongo.Run(ctx,
"mongo:6",
testcontainers.WithLogger(testcontainers.TestLogger(t)),
utils.WithTestLogConsumer(t),
testcontainersutils.WithTestLogConsumer(t),
)
utils.AssertTestContainersError(t, err)
testcontainersutils.AssertError(t, err)

mongoURI, err := tc.server.ConnectionString(ctx)
if err != nil {
Expand Down
9 changes: 5 additions & 4 deletions _integration-tests/tests/redigo/redigo.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"context"
"log"
"net/url"
"orchestrion/integration/utils"
"orchestrion/integration/validator/trace"
"testing"
"time"

Expand All @@ -23,6 +21,9 @@ import (
testredis "github.com/testcontainers/testcontainers-go/modules/redis"
"github.com/testcontainers/testcontainers-go/wait"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"

testcontainersutils "orchestrion/integration/utils/testcontainers"
"orchestrion/integration/validator/trace"
)

type TestCase struct {
Expand All @@ -37,7 +38,7 @@ func (tc *TestCase) Setup(t *testing.T) {
tc.server, err = testredis.Run(ctx,
"redis:7",
testcontainers.WithLogger(testcontainers.TestLogger(t)),
utils.WithTestLogConsumer(t),
testcontainersutils.WithTestLogConsumer(t),
testcontainers.WithWaitStrategy(
wait.ForAll(
wait.ForLog("* Ready to accept connections"),
Expand All @@ -46,7 +47,7 @@ func (tc *TestCase) Setup(t *testing.T) {
),
),
)
utils.AssertTestContainersError(t, err)
testcontainersutils.AssertError(t, err)

redisURI, err := tc.server.ConnectionString(ctx)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions _integration-tests/tests/shopify_sarama/shopify_sarama.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ package shopify_sarama

import (
"context"
testcontainersutils "orchestrion/integration/utils/testcontainers"
"testing"
"time"

"orchestrion/integration/utils"
"orchestrion/integration/validator/trace"

"github.com/Shopify/sarama"
Expand Down Expand Up @@ -46,9 +46,9 @@ func (tc *TestCase) Setup(t *testing.T) {
"docker.redpanda.com/redpandadata/redpanda:v24.2.1",
redpanda.WithAutoCreateTopics(),
testcontainers.WithLogger(testcontainers.TestLogger(t)),
utils.WithTestLogConsumer(t),
testcontainersutils.WithTestLogConsumer(t),
)
utils.AssertTestContainersError(t, err)
testcontainersutils.AssertError(t, err)

addr, err := tc.server.KafkaSeedBroker(ctx)
require.NoError(t, err, "failed to get seed broker address")
Expand Down
10 changes: 5 additions & 5 deletions _integration-tests/tests/vault/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (
"testing"
"time"

"orchestrion/integration/utils"
"orchestrion/integration/validator/trace"

"github.com/hashicorp/vault/api"
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"
testvault "github.com/testcontainers/testcontainers-go/modules/vault"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"

testcontainersutils "orchestrion/integration/utils/testcontainers"
"orchestrion/integration/validator/trace"
)

type TestCase struct {
Expand All @@ -34,10 +34,10 @@ func (tc *TestCase) Setup(t *testing.T) {
tc.server, err = testvault.Run(ctx,
"vault:1.7.3",
testcontainers.WithLogger(testcontainers.TestLogger(t)),
utils.WithTestLogConsumer(t),
testcontainersutils.WithTestLogConsumer(t),
testvault.WithToken("root"),
)
utils.AssertTestContainersError(t, err)
testcontainersutils.AssertError(t, err)

addr, err := tc.server.HttpHostAddress(ctx)
if err != nil {
Expand Down
Loading

0 comments on commit d7d2d49

Please sign in to comment.