Skip to content

Commit

Permalink
fix(security_groups/dynamic_asgs.go): Update tests to work with the N…
Browse files Browse the repository at this point in the history
…CP/NSX-T CNI (#1067)

NCP configures the NSX-T firewalls to drop by default, rather
than reject, like what silk does. We should allow for both error
cases in our tests.

Additionally, NSX-T firewalls do not support `10.0.0.0/0` as a valid
CIDR block. ASG have been updated to provide 3 sets of internal private
address space to achieve the same goal.
  • Loading branch information
geofffranks authored Feb 24, 2024
1 parent ab2c090 commit 7f50d0b
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions security_groups/dynamic_asgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func assertAppCannotConnect(client *http.Client, proxyRequestURL string) {
respBytes, err := io.ReadAll(resp.Body)
Expect(err).ToNot(HaveOccurred())
resp.Body.Close()
Expect(string(respBytes)).To(MatchRegexp("refused"))
Expect(string(respBytes)).To(MatchRegexp("i/o timeout|connection refused"))
}

func assertEventuallyAppCannotConnect(client *http.Client, proxyRequestURL string) {
Expand All @@ -122,7 +122,7 @@ func assertEventuallyAppCannotConnect(client *http.Client, proxyRequestURL strin
Expect(err).ToNot(HaveOccurred())
resp.Body.Close()
return string(respBytes)
}, 3*time.Minute).Should(MatchRegexp("refused"))
}, 3*time.Minute).Should(MatchRegexp("i/o timeout|refused"))
}

func assertAppCanConnect(client *http.Client, proxyRequestURL string) {
Expand Down Expand Up @@ -150,12 +150,20 @@ func assertEventuallyAppCanConnect(client *http.Client, proxyRequestURL string)
}

func bindCCSecurityGroup(orgName, spaceName string) string {
dest := Destination{
IP: "10.0.0.0/0",
destinations := []Destination{{
IP: "10.0.0.0/8",
Ports: "9024", // internal cc port
Protocol: "tcp",
}
securityGroupName := createSecurityGroup(dest)
}, {
IP: "192.168.0.0/16",
Ports: "9024", // internal cc port
Protocol: "tcp",
}, {
IP: "172.16.0.0/12",
Ports: "9024", // internal cc port
Protocol: "tcp",
}}
securityGroupName := createSecurityGroup(destinations...)
bindSecurityGroup(securityGroupName, orgName, spaceName)

return securityGroupName
Expand Down

0 comments on commit 7f50d0b

Please sign in to comment.