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

test/new-e2e/tests/apm: root tag e2e test #24618

Merged
merged 7 commits into from
Apr 13, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions test/new-e2e/tests/apm/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ func (s *DockerFakeintakeSuite) TestAutoVersionStats() {
}, 2*time.Minute, 10*time.Second, "Failed finding version tags")
}

func (s *DockerFakeintakeSuite) TestIsTraceRootTag() {
err := s.Env().FakeIntake.Client().FlushServerAndResetAggregators()
s.Require().NoError(err)

service := fmt.Sprintf("tracegen-auto-is-trace-root-tag-%s", s.transport)
defer waitTracegenShutdown(&s.Suite, s.Env().FakeIntake)
defer runTracegenDocker(s.Env().RemoteHost, service, tracegenCfg{transport: s.transport})()
s.EventuallyWithTf(func(c *assert.CollectT) {
testIsTraceRootTag(s.T(), c, s.Env().FakeIntake)
}, 2*time.Minute, 10*time.Second, "Failed finding is_trace_root tag")
}

func (s *DockerFakeintakeSuite) TestStatsForService() {
err := s.Env().FakeIntake.Client().FlushServerAndResetAggregators()
s.Require().NoError(err)
Expand Down
19 changes: 19 additions & 0 deletions test/new-e2e/tests/apm/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,25 @@ func testAutoVersionStats(t *testing.T, c *assert.CollectT, intake *components.F
}
}

func testIsTraceRootTag(t *testing.T, c *assert.CollectT, intake *components.FakeIntake) {
t.Helper()
stats, err := intake.Client().GetAPMStats()
assert.NoError(c, err)
assert.NotEmpty(c, stats)
t.Log("Got apm stats:", spew.Sdump(stats))
for _, p := range stats {
for _, s := range p.StatsPayload.Stats {
t.Log("Client Payload:", spew.Sdump(s))
for _, b := range s.Stats {
for _, cs := range b.Stats {
t.Logf("Got IsTraceRoot: %v", cs.GetIsTraceRoot())
assert.Equal(t, trace.TraceRootFlag_TRUE, cs.GetIsTraceRoot())
}
}
}
}
}

func getContainerTags(t *testing.T, tp *trace.TracerPayload) (map[string]string, bool) {
ctags, ok := tp.Tags["_dd.tags.container"]
if !ok {
Expand Down
23 changes: 23 additions & 0 deletions test/new-e2e/tests/apm/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,29 @@ func (s *VMFakeintakeSuite) TestAutoVersionStats() {
}, 3*time.Minute, 10*time.Second, "Failed finding stats")
}

func (s *VMFakeintakeSuite) TestIsTraceRootTag() {
err := s.Env().FakeIntake.Client().FlushServerAndResetAggregators()
s.Require().NoError(err)

service := fmt.Sprintf("tracegen-stats-%s", s.transport)

// Wait for agent to be live
s.T().Log("Waiting for Trace Agent to be live.")
s.Require().NoError(waitRemotePort(s, 8126))

// Run Trace Generator
s.T().Log("Starting Trace Generator.")
defer waitTracegenShutdown(&s.Suite, s.Env().FakeIntake)
shutdown := runTracegenDocker(s.Env().RemoteHost, service, tracegenCfg{transport: s.transport})
defer shutdown()

s.EventuallyWithTf(func(c *assert.CollectT) {
s.logStatus()
testIsTraceRootTag(s.T(), c, s.Env().FakeIntake)
s.logJournal()
}, 3*time.Minute, 10*time.Second, "Failed finding stats")
}

func (s *VMFakeintakeSuite) TestBasicTrace() {
err := s.Env().FakeIntake.Client().FlushServerAndResetAggregators()
s.Require().NoError(err)
Expand Down
Loading