-
Notifications
You must be signed in to change notification settings - Fork 5
Add release tests for NAT #980
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive test coverage for NAT (Network Address Translation) functionality in gateway peering configurations. The changes extend the existing VPC peering test framework to support NAT scenarios including basic NAT peering and overlapping subnet resolution using NAT.
- Extends existing gateway peering functions to accept NAT CIDR parameters
- Adds two new test cases for NAT functionality with expected failure markers
- Enhances test reporting infrastructure to support expected failures (XFAIL)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Test Results 13 files 52 suites 5h 19m 36s ⏱️ Results for commit 18a54e6. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
pkg/hhfab/release.go
Outdated
| Subnets: map[string]*vpcapi.VPCSubnet{ | ||
| "subnet-01": { | ||
| Subnet: existingSubnetCIDR, // Same subnet as vpc-01! (10.0.1.0/24) | ||
| VLAN: 1020, // Use a known available VLAN |
Copilot
AI
Sep 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The VLAN ID 1020 is hardcoded. Consider using a constant or dynamic allocation to avoid potential conflicts with other tests or deployments.
pkg/hhfab/release.go
Outdated
| vpc1NATCIDR := []string{"192.168.11.0/24"} | ||
| vpc2NATCIDR := []string{"192.168.12.0/24"} |
Copilot
AI
Sep 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAT CIDR ranges are hardcoded in multiple places (lines 2453-2454 and 2674-2675). Consider defining these as constants to ensure consistency and make them easier to modify.
pkg/hhfab/release.go
Outdated
| func appendGwPeeringSpec(gwPeerings map[string]*gwapi.PeeringSpec, vpc1, vpc2 *vpcapi.VPC, vpc1Subnets, vpc2Subnets []string) { | ||
| // If vpc1NATCIDR or vpc2NATCIDR are provided, NAT will be configured for the respective VPC | ||
| // NOTE: vpc1Subnets/vpc2Subnets currently always receive nil in basic tests (for future multi-subnet suite) | ||
| func appendGwPeeringSpec(gwPeerings map[string]*gwapi.PeeringSpec, vpc1, vpc2 *vpcapi.VPC, vpc1Subnets, vpc2Subnets, vpc1NATCIDR, vpc2NATCIDR []string) { //nolint:unparam |
Copilot
AI
Sep 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function signature has grown to 7 parameters, which impacts readability and maintainability. Consider using a struct parameter to group related parameters (e.g., PeeringConfig struct with VPC1Subnets, VPC2Subnets, VPC1NATCIDR, VPC2NATCIDR fields).
18a54e6 to
0a23879
Compare
Release Tests 16 files 64 suites 7h 11m 41s ⏱️ Results for commit d681737. ♻️ This comment has been updated with latest results. |
e7639b5 to
0ee3b2f
Compare
|
@qmonnet, as you may have taken a look at this PR, could you please share which additional tests would be needed to give coverage to the 1st release? Thanks |
0ee3b2f to
7ed9102
Compare
|
Let's see, I think ideally we should cover the following things: Stateless NAT
Stateful NAT
Additional tests
Note: IPv6 should work the same as IPv4 in most cases, so dedicated tests are maybe not indispensable but would be nice to have. UDP should be the same as TCP in most cases. |
7ed9102 to
4555fc4
Compare
e1c34d3 to
59ae446
Compare
6816981 to
45a5c1a
Compare
edipascale
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pau-hedgehog,this was very useful for testing the latest release! However I'd like to improve some things, since we have time before it can be merged.
Note that I completely ignored the new test connectivity code as that will be thrown out regardless
pkg/hhfab/release.go
Outdated
| // Use all subnets from both VPCs by passing empty subnet lists | ||
| appendGwPeeringSpec(gwPeerings, vpc1, vpc2, nil, nil) | ||
| // Use all subnets from both VPCs, no NAT | ||
| appendGwPeeringSpec(gwPeerings, vpc1, vpc2, nil, nil, nil, nil, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: for cases like these where you have a basic use-case with only a subset of parameters and that is called in a bunch of places, I would keep the original function signature and make it a wrapper around the call to the new signature, i.e.:
func appendGwPeeringSpec(gwPeerings map[string]*gwapi.PeeringSpec, vpc1, vpc2 *vpcapi.VPC, vpc1Subnets, vpc2Subnets []string) {
appendGwPeeringSpecWithNAT(gwPeerings, vpc1, vpc2, vpc1Subnets, vpc2Subnets, nil, nil, nil)
}
func appendGwPeeringSpecWithNAT(...) {
The struct alternative is also a valid option
pkg/hhfab/release.go
Outdated
| } | ||
|
|
||
| // Wait for NAT gateway peering to take effect | ||
| time.Sleep(15 * time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we do a waitReady instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced
add expected fail capability to release tests add Stateful NAT GW Peering test temporary until TestConnectivity updated: add function to calculate NAT offsets add function to validate NAT connectivity Signed-off-by: Pau Capdevila <[email protected]>
45a5c1a to
ee4a470
Compare
gatewayPeeringStatelessSourceNATTest gatewayPeeringStatelessDestinationNATTest gatewayPeeringStatelessNATWithIPExclusionTest gatewayPeeringStatelessNATWithNATPoolExclusionTest Signed-off-by: Pau Capdevila <[email protected]>
also removes redundant VPC removals Signed-off-by: Pau Capdevila <[email protected]>
Signed-off-by: Pau Capdevila <[email protected]>
0492ddd to
d681737
Compare
No description provided.