Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 felix/iptables/actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var _ = DescribeTable("Actions",
Entry("SNATAction", environment.Features{}, SNATAction{ToAddr: "10.0.0.1"}, "--jump SNAT --to-source 10.0.0.1"),
Entry("SNATAction fully random", environment.Features{SNATFullyRandom: true}, SNATAction{ToAddr: "10.0.0.1"}, "--jump SNAT --to-source 10.0.0.1 --random-fully"),
Entry("MasqAction", environment.Features{}, MasqAction{}, "--jump MASQUERADE"),
Entry("MasqAction", environment.Features{}, MasqAction{ToPorts: "32768-65535"}, "--jump MASQUERADE --to-ports 32768-65535"),

Copilot AI Jan 28, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test entry name "MasqAction" is duplicated on lines 39, 40, and 41. While this follows an existing pattern in this file, Ginkgo test entries should have unique names for better test identification and reporting. Consider using more descriptive names like "MasqAction with ToPorts", "MasqAction fully random", etc.

Copilot uses AI. Check for mistakes.
Entry("MasqAction", environment.Features{MASQFullyRandom: true}, MasqAction{}, "--jump MASQUERADE --random-fully"),
Comment on lines +40 to 41

Copilot AI Jan 28, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MasqAction implementation supports both ToPorts and MASQFullyRandom features simultaneously (line 313 in actions.go appends fullyRand even when ToPorts is set), but there is no test case covering this combination. Consider adding a test case like: Entry("MasqAction with ToPorts and fully random", environment.Features{MASQFullyRandom: true}, MasqAction{ToPorts: "32768-65535"}, "--jump MASQUERADE --to-ports 32768-65535 --random-fully")

Copilot uses AI. Check for mistakes.
Entry("ClearMarkAction", environment.Features{}, ClearMarkAction{Mark: 0x1000}, "--jump MARK --set-mark 0/0x1000"),
Entry("SetMarkAction", environment.Features{}, SetMarkAction{Mark: 0x1000}, "--jump MARK --set-mark 0x1000/0x1000"),
Expand Down
2 changes: 1 addition & 1 deletion felix/nftables/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func (g MasqAction) ToFragment(features *environment.Features) string {
}
if g.ToPorts != "" {
// e.g., masquerade to :1024-65535
return fmt.Sprintf("masquerade to %s"+fullyRand, g.ToPorts)
return fmt.Sprintf("masquerade to :%s"+fullyRand, g.ToPorts)
}
return "masquerade" + fullyRand
}
Expand Down
1 change: 1 addition & 0 deletions felix/nftables/actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var _ = DescribeTable("Actions",
Entry("SNATAction", environment.Features{}, SNATAction{ToAddr: "10.0.0.1"}, "snat to 10.0.0.1"),
Entry("SNATAction fully random", environment.Features{SNATFullyRandom: true}, SNATAction{ToAddr: "10.0.0.1"}, "snat to 10.0.0.1 fully-random"),
Entry("MasqAction", environment.Features{}, MasqAction{}, "masquerade"),
Entry("MasqAction", environment.Features{}, MasqAction{ToPorts: "32768-65535"}, "masquerade to :32768-65535"),

Copilot AI Jan 28, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test entry name "MasqAction" is duplicated on lines 39, 40, and 41. While this follows an existing pattern in this file, Ginkgo test entries should have unique names for better test identification and reporting. Consider using more descriptive names like "MasqAction with ToPorts", "MasqAction fully random", etc.

Copilot uses AI. Check for mistakes.
Entry("MasqAction", environment.Features{MASQFullyRandom: true}, MasqAction{}, "masquerade fully-random"),
Comment on lines +40 to 41

Copilot AI Jan 28, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MasqAction implementation supports both ToPorts and MASQFullyRandom features simultaneously (line 332 in actions.go appends fullyRand even when ToPorts is set), but there is no test case covering this combination. Consider adding a test case like: Entry("MasqAction with ToPorts and fully random", environment.Features{MASQFullyRandom: true}, MasqAction{ToPorts: "32768-65535"}, "masquerade to :32768-65535 fully-random")

Copilot uses AI. Check for mistakes.
Entry("ClearMarkAction", environment.Features{}, ClearMarkAction{Mark: 0x1000}, "meta mark set mark & 0xffffefff"),
Entry("SetMarkAction", environment.Features{}, SetMarkAction{Mark: 0x1000}, "meta mark set mark or 0x1000"),
Expand Down
Loading