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

set trace log level for our flakyest tests #21595

Merged
merged 7 commits into from
Dec 20, 2023
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
1 change: 1 addition & 0 deletions pkg/network/tracer/conntracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const (
)

func TestConntrackers(t *testing.T) {
ebpftest.LogLevel(t, "trace")
t.Run("netlink", func(t *testing.T) {
runConntrackerTest(t, "netlink", setupNetlinkConntracker)
})
Expand Down
9 changes: 9 additions & 0 deletions pkg/network/tracer/offsetguess/conntrack.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func (c *conntrackOffsetGuesser) checkAndUpdateCurrentOffset(mp *ebpf.Map, expec
case GuessCtTupleOrigin:
c.status.Offset_origin, overlapped = skipOverlaps(c.status.Offset_origin, c.nfConnRanges())
if overlapped {
log.Tracef("offset %v overlaps with another field, skipping", whatString[GuessWhat(c.status.What)])
// adjusted offset from eBPF overlapped with another field, we need to check new offset
break
}
Expand All @@ -155,11 +156,14 @@ func (c *conntrackOffsetGuesser) checkAndUpdateCurrentOffset(mp *ebpf.Map, expec
c.logAndAdvance(c.status.Offset_origin, GuessCtTupleReply)
break
}
log.Tracef("%v %d does not match expected %d, incrementing offset %d",
whatString[GuessWhat(c.status.What)], c.status.Saddr, expected.saddr, c.status.Offset_origin)
c.status.Offset_origin++
c.status.Offset_origin, _ = skipOverlaps(c.status.Offset_origin, c.nfConnRanges())
case GuessCtTupleReply:
c.status.Offset_reply, overlapped = skipOverlaps(c.status.Offset_reply, c.nfConnRanges())
if overlapped {
log.Tracef("offset %v overlaps with another field, skipping", whatString[GuessWhat(c.status.What)])
// adjusted offset from eBPF overlapped with another field, we need to check new offset
break
}
Expand All @@ -168,11 +172,14 @@ func (c *conntrackOffsetGuesser) checkAndUpdateCurrentOffset(mp *ebpf.Map, expec
c.logAndAdvance(c.status.Offset_reply, GuessCtNet)
break
}
log.Tracef("%v %d does not match expected %d, incrementing offset %d",
whatString[GuessWhat(c.status.What)], c.status.Saddr, expected.daddr, c.status.Offset_reply)
c.status.Offset_reply++
c.status.Offset_reply, _ = skipOverlaps(c.status.Offset_reply, c.nfConnRanges())
case GuessCtNet:
c.status.Offset_netns, overlapped = skipOverlaps(c.status.Offset_netns, c.nfConnRanges())
if overlapped {
log.Tracef("offset %v overlaps with another field, skipping", whatString[GuessWhat(c.status.What)])
// adjusted offset from eBPF overlapped with another field, we need to check new offset
break
}
Expand All @@ -181,6 +188,8 @@ func (c *conntrackOffsetGuesser) checkAndUpdateCurrentOffset(mp *ebpf.Map, expec
c.logAndAdvance(c.status.Offset_netns, GuessNotApplicable)
return c.setReadyState(mp)
}
log.Tracef("%v %d does not match expected %d, incrementing offset %d",
whatString[GuessWhat(c.status.What)], c.status.Netns, expected.netns, c.status.Offset_netns)
c.status.Offset_netns++
c.status.Offset_netns, _ = skipOverlaps(c.status.Offset_netns, c.nfConnRanges())
default:
Expand Down
2 changes: 2 additions & 0 deletions pkg/network/tracer/offsetguess_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func (o offsetT) String() string {
}

func TestOffsetGuess(t *testing.T) {
ebpftest.LogLevel(t, "trace")
ebpftest.TestBuildMode(t, ebpftest.RuntimeCompiled, "", testOffsetGuess)
}

Expand Down Expand Up @@ -156,6 +157,7 @@ func testOffsetGuess(t *testing.T) {
consts := map[offsetT]uint64{}
for _, c := range _consts {
value := c.Value.(uint64)
t.Logf("Guessed offset %v with value %v", c.Name, value)
switch c.Name {
case "offset_saddr":
consts[offsetSaddr] = value
Expand Down
4 changes: 4 additions & 0 deletions pkg/network/tracer/tracer_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
ddebpf "github.com/DataDog/datadog-agent/pkg/ebpf"
"github.com/DataDog/datadog-agent/pkg/ebpf/bytecode"
rc "github.com/DataDog/datadog-agent/pkg/ebpf/bytecode/runtime"
"github.com/DataDog/datadog-agent/pkg/ebpf/ebpftest"
"github.com/DataDog/datadog-agent/pkg/network"
"github.com/DataDog/datadog-agent/pkg/network/config"
"github.com/DataDog/datadog-agent/pkg/network/config/sysctl"
Expand Down Expand Up @@ -382,6 +383,7 @@ func (s *TracerSuite) TestConnectionExpirationRegression() {

func (s *TracerSuite) TestConntrackExpiration() {
t := s.T()
ebpftest.LogLevel(t, "trace")
netlinktestutil.SetupDNAT(t)
wg := sync.WaitGroup{}

Expand Down Expand Up @@ -2027,6 +2029,7 @@ func (s *TracerSuite) TestGetHelpersTelemetry() {
}

func TestEbpfConntrackerFallback(t *testing.T) {
ebpftest.LogLevel(t, "trace")
type testCase struct {
enableRuntimeCompiler bool
allowPrecompiledFallback bool
Expand Down Expand Up @@ -2102,6 +2105,7 @@ func TestEbpfConntrackerFallback(t *testing.T) {
}

func TestConntrackerFallback(t *testing.T) {
ebpftest.LogLevel(t, "trace")
cfg := testConfig()
cfg.EnableEbpfConntracker = false
cfg.AllowNetlinkConntrackerFallback = true
Expand Down
Loading