Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lixmal committed Dec 22, 2024
1 parent 07019d2 commit ed77f48
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 53 deletions.
12 changes: 12 additions & 0 deletions client/firewall/uspfilter/conntrack/tcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ func TestTCPStateMachine(t *testing.T) {
{
name: "Normal Handshake",
test: func(t *testing.T) {
t.Helper()

// Send initial SYN
tracker.TrackOutbound(srcIP, dstIP, srcPort, dstPort, TCPSyn)

Expand All @@ -91,6 +93,8 @@ func TestTCPStateMachine(t *testing.T) {
{
name: "Normal Close",
test: func(t *testing.T) {
t.Helper()

// First establish connection
establishConnection(t, tracker, srcIP, dstIP, srcPort, dstPort)

Expand All @@ -112,6 +116,8 @@ func TestTCPStateMachine(t *testing.T) {
{
name: "RST During Connection",
test: func(t *testing.T) {
t.Helper()

// First establish connection
establishConnection(t, tracker, srcIP, dstIP, srcPort, dstPort)

Expand All @@ -121,12 +127,16 @@ func TestTCPStateMachine(t *testing.T) {

// Verify connection is closed
valid = tracker.IsValidInbound(dstIP, srcIP, dstPort, srcPort, TCPPush|TCPAck)
t.Helper()

require.False(t, valid, "Data should be blocked after RST")
},
},
{
name: "Simultaneous Close",
test: func(t *testing.T) {
t.Helper()

// First establish connection
establishConnection(t, tracker, srcIP, dstIP, srcPort, dstPort)

Expand All @@ -145,6 +155,8 @@ func TestTCPStateMachine(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Helper()

tracker = NewTCPTracker(DefaultTCPTimeout)
tt.test(t)
})
Expand Down
Loading

0 comments on commit ed77f48

Please sign in to comment.