Skip to content

Commit

Permalink
Update test-infra-definitions and remove waiting for fakeintake (#20959)
Browse files Browse the repository at this point in the history
* update test-infra-definitions and remove waiting for fakeintake

* go mod tidy

* update to new versio of test-infra

* go mod tidy

* fix nss test logs
  • Loading branch information
pgimalac authored Nov 24, 2023
1 parent fd3b961 commit b5341d1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 43 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ variables:
# To use images from test-infra-definitions dev branches, set the SUFFIX variable to -dev
# and check the job creating the image to make sure you have the right SHA prefix
TEST_INFRA_DEFINITIONS_BUILDIMAGES_SUFFIX: ""
TEST_INFRA_DEFINITIONS_BUILDIMAGES: 2edaabddf28b
TEST_INFRA_DEFINITIONS_BUILDIMAGES: c8eaaee94472
DATADOG_AGENT_BUILDERS: v22276738-b36b132

DATADOG_AGENT_EMBEDDED_PATH: /opt/datadog-agent/embedded
Expand Down Expand Up @@ -1001,4 +1001,4 @@ workflow:

.except_mergequeue:
- <<: *if_mergequeue
when: never
when: never
10 changes: 5 additions & 5 deletions test/new-e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
// `TEST_INFRA_DEFINITIONS_BUILDIMAGES` matches the commit sha in the module version
// Example: github.com/DataDog/test-infra-definitions v0.0.0-YYYYMMDDHHmmSS-0123456789AB
// => TEST_INFRA_DEFINITIONS_BUILDIMAGES: 0123456789AB
github.com/DataDog/test-infra-definitions v0.0.0-20231122132756-2edaabddf28b
github.com/DataDog/test-infra-definitions v0.0.0-20231123150722-c8eaaee94472
github.com/aws/aws-sdk-go-v2 v1.22.1
github.com/aws/aws-sdk-go-v2/config v1.18.40
github.com/aws/aws-sdk-go-v2/service/ec2 v1.130.0
Expand All @@ -35,7 +35,7 @@ require (
github.com/google/uuid v1.3.1
github.com/kr/pretty v0.3.1
github.com/pkg/sftp v1.13.6
github.com/pulumi/pulumi/sdk/v3 v3.83.0
github.com/pulumi/pulumi/sdk/v3 v3.84.0
github.com/samber/lo v1.38.1
github.com/sethvargo/go-retry v0.2.4
github.com/stretchr/testify v1.8.5-0.20231013065317-89920137cdfa
Expand Down Expand Up @@ -162,8 +162,8 @@ require (
github.com/pkg/term v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pulumi/pulumi-aws/sdk/v5 v5.42.0 // indirect
github.com/pulumi/pulumi-awsx/sdk v1.0.5 // indirect
github.com/pulumi/pulumi-command/sdk v0.9.0 // indirect
github.com/pulumi/pulumi-awsx/sdk v1.0.6 // indirect
github.com/pulumi/pulumi-command/sdk v0.9.2 // indirect
github.com/pulumi/pulumi-docker/sdk/v3 v3.6.1 // indirect
github.com/pulumi/pulumi-eks/sdk v1.0.2 // indirect
github.com/pulumi/pulumi-kubernetes/sdk/v3 v3.30.2 // indirect
Expand Down Expand Up @@ -203,7 +203,7 @@ require (
golang.org/x/tools v0.11.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/grpc v1.57.1 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
Expand Down
20 changes: 10 additions & 10 deletions test/new-e2e/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
fi "github.com/DataDog/datadog-agent/test/fakeintake/client"
"github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/e2e"
"github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/e2e/client"
"github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/e2e/params"
)

type multiFakeIntakeEnv struct {
Expand Down Expand Up @@ -109,21 +110,7 @@ type multiFakeIntakeSuite struct {
}

func TestMultiFakeintakeSuite(t *testing.T) {
e2e.Run(t, &multiFakeIntakeSuite{}, multiFakeintakeStackDef())
}

// SetupSuite waits for both fakeintakes to be ready before running tests.
func (v *multiFakeIntakeSuite) SetupSuite() {
v.Suite.SetupSuite() // need to call the original definition of SetupSuite

fakeintake1 := v.Env().Fakeintake1
fakeintake2 := v.Env().Fakeintake2

// Wait for the fakeintakes to be ready to avoid 503
require.EventuallyWithT(v.T(), func(c *assert.CollectT) {
assert.NoError(c, fakeintake1.GetServerHealth())
assert.NoError(c, fakeintake2.GetServerHealth())
}, intakeMaxWaitTime, intakeTick)
e2e.Run(t, &multiFakeIntakeSuite{}, multiFakeintakeStackDef(), params.WithStackName("mystack000"))
}

// TestNSSFailover tests that the agent correctly picks-up an NSS change of the intake.
Expand Down Expand Up @@ -165,7 +152,6 @@ func (v *multiFakeIntakeSuite) TestNSSFailover() {
v.UpdateEnv(multiFakeintakeStackDef(agentOptions...))

// check that fakeintake1 is used as intake and not fakeintake2
v.T().Logf("checking that the agent contacts main intake at %s", fakeintake1IP)
v.requireIntakeIsUsed(v.Env().Fakeintake1, intakeMaxWaitTime, intakeTick)
v.requireIntakeNotUsed(v.Env().Fakeintake2, intakeMaxWaitTime, intakeTick)

Expand All @@ -175,7 +161,6 @@ func (v *multiFakeIntakeSuite) TestNSSFailover() {
setHostEntry(v.T(), v.Env().VM, intakeName, fakeintake2IP)

// check that fakeintake2 is used as intake and not fakeintake1
v.T().Logf("checking that the agent contacts fallback intake at %s", fakeintake2IP)
intakeMaxWaitTime := connectionResetInterval*time.Second + intakeMaxWaitTime
v.requireIntakeIsUsed(v.Env().Fakeintake2, intakeMaxWaitTime, intakeTick)
v.requireIntakeNotUsed(v.Env().Fakeintake1, intakeMaxWaitTime, intakeTick)
Expand Down Expand Up @@ -204,6 +189,7 @@ func (v *multiFakeIntakeSuite) requireIntakeIsUsed(intake *client.Fakeintake, in
assert.NoError(t, err)
}

v.T().Logf("checking that the agent contacts intake at %s", intake.URL())
require.EventuallyWithT(v.T(), checkFn, intakeMaxWaitTime, intakeTick)
}

Expand All @@ -228,7 +214,8 @@ func (v *multiFakeIntakeSuite) requireIntakeNotUsed(intake *client.Fakeintake, i
assert.Empty(t, stats)
}

require.EventuallyWithT(v.T(), checkFn, intakeMaxWaitTime, intakeTick+intakeUnusedWaitTime)
v.T().Logf("checking that the agent doesn't contact intake at %s", intake.URL())
require.EventuallyWithT(v.T(), checkFn, intakeMaxWaitTime, intakeTick)
}

// setHostEntry adds an entry in /etc/hosts for the given hostname and hostIP
Expand Down
10 changes: 2 additions & 8 deletions test/new-e2e/tests/agent-subcommands/flare/flare_common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ package flare
import (
_ "embed"
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/DataDog/datadog-agent/test/fakeintake/client/flare"
"github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/e2e"
"github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/e2e/client"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

type baseFlareSuite struct {
Expand All @@ -39,11 +38,6 @@ func (v *baseFlareSuite) TestFlareDefaultFiles() {
}

func requestAgentFlareAndFetchFromFakeIntake(t *testing.T, agent client.Agent, fakeintake *client.Fakeintake, flareArgs ...client.AgentArgsOption) flare.Flare {
// Wait for the fakeintake to be ready to avoid 503 when sending the flare
assert.EventuallyWithT(t, func(c *assert.CollectT) {
assert.NoError(c, fakeintake.Client.GetServerHealth())
}, 5*time.Minute, 20*time.Second)

_ = agent.Flare(flareArgs...)

flare, err := fakeintake.Client.GetLatestFlare()
Expand Down

0 comments on commit b5341d1

Please sign in to comment.