Skip to content

Commit

Permalink
Simont1/root tag e2e test (#24618)
Browse files Browse the repository at this point in the history
Co-authored-by: knusbaum <kyle@datadog.com>
  • Loading branch information
2 people authored and alexgallotta committed May 9, 2024
1 parent c8b23bb commit d32a906
Showing 3 changed files with 54 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/new-e2e/tests/apm/docker_test.go
Original file line number Diff line number Diff line change
@@ -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)
19 changes: 19 additions & 0 deletions test/new-e2e/tests/apm/tests.go
Original file line number Diff line number Diff line change
@@ -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 {
23 changes: 23 additions & 0 deletions test/new-e2e/tests/apm/vm_test.go
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit d32a906

Please sign in to comment.