Skip to content

Commit

Permalink
chore: update all dependencies (#480)
Browse files Browse the repository at this point in the history
Updated all go.mod dependencies to latest.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Romain Marcadier <[email protected]>
Co-authored-by: Romain Marcadier <[email protected]>
  • Loading branch information
3 people authored Dec 23, 2024
1 parent 81ab050 commit f729796
Show file tree
Hide file tree
Showing 67 changed files with 419 additions and 395 deletions.
5 changes: 3 additions & 2 deletions _integration-tests/tests/99designs.gqlgen/gqlgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package gqlgen

import (
"context"
"fmt"
"testing"

Expand All @@ -23,13 +24,13 @@ type TestCase struct {
server *handler.Server
}

func (tc *TestCase) Setup(*testing.T) {
func (tc *TestCase) Setup(context.Context, *testing.T) {
schema := graph.NewExecutableSchema(graph.Config{Resolvers: &graph.Resolver{}})
tc.server = handler.New(schema)
tc.server.AddTransport(transport.POST{})
}

func (tc *TestCase) Run(t *testing.T) {
func (tc *TestCase) Run(_ context.Context, t *testing.T) {
c := client.New(tc.server)

const (
Expand Down
5 changes: 3 additions & 2 deletions _integration-tests/tests/aws.v1/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package awsv1

import (
"context"
"fmt"
"testing"

Expand All @@ -26,7 +27,7 @@ type TestCase struct {
cfg *aws.Config
}

func (tc *TestCase) Setup(t *testing.T) {
func (tc *TestCase) Setup(_ context.Context, t *testing.T) {
utils.SkipIfProviderIsNotHealthy(t)

server, host, port := utils.StartDynamoDBTestContainer(t)
Expand All @@ -39,7 +40,7 @@ func (tc *TestCase) Setup(t *testing.T) {
}
}

func (tc *TestCase) Run(t *testing.T) {
func (tc *TestCase) Run(_ context.Context, t *testing.T) {
ddb := dynamodb.New(session.Must(session.NewSession(tc.cfg)))
_, err := ddb.ListTables(nil)
require.NoError(t, err)
Expand Down
7 changes: 2 additions & 5 deletions _integration-tests/tests/aws.v2/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"context"
"fmt"
"testing"
"time"

"datadoghq.dev/orchestrion/_integration-tests/utils"
"datadoghq.dev/orchestrion/_integration-tests/validator/trace"
Expand All @@ -28,15 +27,13 @@ type base struct {
port string
}

func (b *base) setup(t *testing.T) {
func (b *base) setup(_ context.Context, t *testing.T) {
utils.SkipIfProviderIsNotHealthy(t)

b.server, b.host, b.port = utils.StartDynamoDBTestContainer(t)
}

func (b *base) run(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
defer cancel()
func (b *base) run(ctx context.Context, t *testing.T) {
ddb := dynamodb.NewFromConfig(b.cfg)
_, err := ddb.ListTables(ctx, nil)
require.NoError(t, err)
Expand Down
10 changes: 5 additions & 5 deletions _integration-tests/tests/aws.v2/load_default_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ type TestCaseLoadDefaultConfig struct {
base
}

func (tc *TestCaseLoadDefaultConfig) Setup(t *testing.T) {
tc.setup(t)
func (tc *TestCaseLoadDefaultConfig) Setup(ctx context.Context, t *testing.T) {
tc.setup(ctx, t)

cfg, err := config.LoadDefaultConfig(context.Background(),
cfg, err := config.LoadDefaultConfig(ctx,
config.WithRegion("test-region-1337"),
config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider("NOTANACCESSKEY", "NOTASECRETKEY", "")),
)
Expand All @@ -35,8 +35,8 @@ func (tc *TestCaseLoadDefaultConfig) Setup(t *testing.T) {
tc.cfg = cfg
}

func (tc *TestCaseLoadDefaultConfig) Run(t *testing.T) {
tc.base.run(t)
func (tc *TestCaseLoadDefaultConfig) Run(ctx context.Context, t *testing.T) {
tc.base.run(ctx, t)
}

func (tc *TestCaseLoadDefaultConfig) ExpectedTraces() trace.Traces {
Expand Down
9 changes: 5 additions & 4 deletions _integration-tests/tests/aws.v2/new_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package awsv2

import (
"context"
"fmt"
"testing"

Expand All @@ -20,8 +21,8 @@ type TestCaseNewConfig struct {
base
}

func (tc *TestCaseNewConfig) Setup(t *testing.T) {
tc.setup(t)
func (tc *TestCaseNewConfig) Setup(ctx context.Context, t *testing.T) {
tc.setup(ctx, t)

cfg := aws.NewConfig()
cfg.Region = "test-region-1337"
Expand All @@ -30,8 +31,8 @@ func (tc *TestCaseNewConfig) Setup(t *testing.T) {
tc.cfg = *cfg
}

func (tc *TestCaseNewConfig) Run(t *testing.T) {
tc.base.run(t)
func (tc *TestCaseNewConfig) Run(ctx context.Context, t *testing.T) {
tc.base.run(ctx, t)
}

func (tc *TestCaseNewConfig) ExpectedTraces() trace.Traces {
Expand Down
9 changes: 5 additions & 4 deletions _integration-tests/tests/aws.v2/struct_literal.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package awsv2

import (
"context"
"fmt"
"testing"

Expand All @@ -20,8 +21,8 @@ type TestCaseStructLiteral struct {
base
}

func (tc *TestCaseStructLiteral) Setup(t *testing.T) {
tc.setup(t)
func (tc *TestCaseStructLiteral) Setup(ctx context.Context, t *testing.T) {
tc.setup(ctx, t)

tc.cfg = aws.Config{
Region: "test-region-1337",
Expand All @@ -30,8 +31,8 @@ func (tc *TestCaseStructLiteral) Setup(t *testing.T) {
}
}

func (tc *TestCaseStructLiteral) Run(t *testing.T) {
tc.base.run(t)
func (tc *TestCaseStructLiteral) Run(ctx context.Context, t *testing.T) {
tc.base.run(ctx, t)
}

func (tc *TestCaseStructLiteral) ExpectedTraces() trace.Traces {
Expand Down
9 changes: 5 additions & 4 deletions _integration-tests/tests/aws.v2/struct_literal_ptr.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package awsv2

import (
"context"
"fmt"
"testing"

Expand All @@ -20,8 +21,8 @@ type TestCaseStructLiteralPtr struct {
base
}

func (tc *TestCaseStructLiteralPtr) Setup(t *testing.T) {
tc.setup(t)
func (tc *TestCaseStructLiteralPtr) Setup(ctx context.Context, t *testing.T) {
tc.setup(ctx, t)

cfg := &aws.Config{
Region: "test-region-1337",
Expand All @@ -31,8 +32,8 @@ func (tc *TestCaseStructLiteralPtr) Setup(t *testing.T) {
tc.cfg = *cfg
}

func (tc *TestCaseStructLiteralPtr) Run(t *testing.T) {
tc.base.run(t)
func (tc *TestCaseStructLiteralPtr) Run(ctx context.Context, t *testing.T) {
tc.base.run(ctx, t)
}

func (tc *TestCaseStructLiteralPtr) ExpectedTraces() trace.Traces {
Expand Down
7 changes: 4 additions & 3 deletions _integration-tests/tests/chi.v5/chi.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type TestCase struct {
*http.Server
}

func (tc *TestCase) Setup(t *testing.T) {
func (tc *TestCase) Setup(_ context.Context, t *testing.T) {
router := chi.NewRouter()

tc.Server = &http.Server{
Expand All @@ -39,13 +39,14 @@ func (tc *TestCase) Setup(t *testing.T) {

go func() { assert.ErrorIs(t, tc.Server.ListenAndServe(), http.ErrServerClosed) }()
t.Cleanup(func() {
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
// Using a new 10s-timeout context, as we may be running cleanup after the original context expired.
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
assert.NoError(t, tc.Server.Shutdown(ctx))
})
}

func (tc *TestCase) Run(t *testing.T) {
func (tc *TestCase) Run(_ context.Context, t *testing.T) {
resp, err := http.Get(fmt.Sprintf("http://%s/", tc.Server.Addr))
require.NoError(t, err)
require.Equal(t, http.StatusOK, resp.StatusCode)
Expand Down
17 changes: 12 additions & 5 deletions _integration-tests/tests/confluent-kafka-go.v1/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package kafka

import (
"context"
"strings"
"testing"
"time"
Expand All @@ -17,6 +18,7 @@ import (
kafkatest "github.com/testcontainers/testcontainers-go/modules/kafka"

"datadoghq.dev/orchestrion/_integration-tests/utils"
"datadoghq.dev/orchestrion/_integration-tests/utils/backoff"
"datadoghq.dev/orchestrion/_integration-tests/validator/trace"
)

Expand All @@ -31,16 +33,16 @@ type TestCase struct {
addr []string
}

func (tc *TestCase) Setup(t *testing.T) {
func (tc *TestCase) Setup(_ context.Context, t *testing.T) {
utils.SkipIfProviderIsNotHealthy(t)
container, addr := utils.StartKafkaTestContainer(t)
tc.container = container
tc.addr = []string{addr}
}

func (tc *TestCase) Run(t *testing.T) {
func (tc *TestCase) Run(ctx context.Context, t *testing.T) {
tc.produceMessage(t)
tc.consumeMessage(t)
tc.consumeMessage(ctx, t)
}

func (tc *TestCase) kafkaBootstrapServers() string {
Expand Down Expand Up @@ -74,7 +76,7 @@ func (tc *TestCase) produceMessage(t *testing.T) {
require.NoError(t, err, "failed to send message")
}

func (tc *TestCase) consumeMessage(t *testing.T) {
func (tc *TestCase) consumeMessage(ctx context.Context, t *testing.T) {
t.Helper()

cfg := &kafka.ConfigMap{
Expand All @@ -94,7 +96,12 @@ func (tc *TestCase) consumeMessage(t *testing.T) {
})
require.NoError(t, err)

m, err := c.ReadMessage(3000 * time.Millisecond)
m, err := backoff.Retry(
ctx,
backoff.NewExponentialStrategy(100*time.Millisecond, 2, time.Second),
func() (*kafka.Message, error) { return c.ReadMessage(3 * time.Second) },
nil,
)
require.NoError(t, err)

_, err = c.CommitMessage(m)
Expand Down
17 changes: 12 additions & 5 deletions _integration-tests/tests/confluent-kafka-go.v2/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
package kafka

import (
"context"
"strings"
"testing"
"time"
Expand All @@ -17,6 +18,7 @@ import (
kafkatest "github.com/testcontainers/testcontainers-go/modules/kafka"

"datadoghq.dev/orchestrion/_integration-tests/utils"
"datadoghq.dev/orchestrion/_integration-tests/utils/backoff"
"datadoghq.dev/orchestrion/_integration-tests/validator/trace"
)

Expand All @@ -31,16 +33,16 @@ type TestCase struct {
addr []string
}

func (tc *TestCase) Setup(t *testing.T) {
func (tc *TestCase) Setup(_ context.Context, t *testing.T) {
utils.SkipIfProviderIsNotHealthy(t)
container, addr := utils.StartKafkaTestContainer(t)
tc.container = container
tc.addr = []string{addr}
}

func (tc *TestCase) Run(t *testing.T) {
func (tc *TestCase) Run(ctx context.Context, t *testing.T) {
tc.produceMessage(t)
tc.consumeMessage(t)
tc.consumeMessage(ctx, t)
}

func (tc *TestCase) kafkaBootstrapServers() string {
Expand Down Expand Up @@ -74,7 +76,7 @@ func (tc *TestCase) produceMessage(t *testing.T) {
require.NoError(t, err, "failed to send message")
}

func (tc *TestCase) consumeMessage(t *testing.T) {
func (tc *TestCase) consumeMessage(ctx context.Context, t *testing.T) {
t.Helper()

cfg := &kafka.ConfigMap{
Expand All @@ -94,7 +96,12 @@ func (tc *TestCase) consumeMessage(t *testing.T) {
})
require.NoError(t, err)

m, err := c.ReadMessage(3000 * time.Millisecond)
m, err := backoff.Retry(
ctx,
backoff.NewExponentialStrategy(100*time.Millisecond, 2, time.Second),
func() (*kafka.Message, error) { return c.ReadMessage(3 * time.Second) },
nil,
)
require.NoError(t, err)

_, err = c.CommitMessage(m)
Expand Down
6 changes: 3 additions & 3 deletions _integration-tests/tests/dd-span/ddspan.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (

type TestCase struct{}

func (*TestCase) Setup(*testing.T) {}
func (*TestCase) Setup(context.Context, *testing.T) {}

func (*TestCase) Run(t *testing.T) {
span, ctx := tracer.StartSpanFromContext(context.Background(), "test.root")
func (*TestCase) Run(ctx context.Context, t *testing.T) {
span, ctx := tracer.StartSpanFromContext(ctx, "test.root")
defer span.Finish()

req, err := http.NewRequestWithContext(ctx, http.MethodGet, "http://localhost:0/", nil)
Expand Down
7 changes: 4 additions & 3 deletions _integration-tests/tests/echo.v4/echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type TestCase struct {
addr string
}

func (tc *TestCase) Setup(t *testing.T) {
func (tc *TestCase) Setup(_ context.Context, t *testing.T) {
tc.Echo = echo.New()
tc.Echo.Logger.SetOutput(io.Discard)

Expand All @@ -37,13 +37,14 @@ func (tc *TestCase) Setup(t *testing.T) {

go func() { assert.ErrorIs(t, tc.Echo.Start(tc.addr), http.ErrServerClosed) }()
t.Cleanup(func() {
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
// Using a new 10s-timeout context, as we may be running cleanup after the original context expired.
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
require.NoError(t, tc.Echo.Shutdown(ctx))
})
}

func (tc *TestCase) Run(t *testing.T) {
func (tc *TestCase) Run(_ context.Context, t *testing.T) {
resp, err := http.Get("http://" + tc.addr + "/ping")
require.NoError(t, err)
require.Equal(t, http.StatusOK, resp.StatusCode)
Expand Down
Loading

0 comments on commit f729796

Please sign in to comment.