Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Shane Utt <shaneutt@linux.com>
  • Loading branch information
rainest and shaneutt committed Apr 15, 2022
1 parent ec9b0c1 commit e335215
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion internal/controllers/gateway/gateway_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ func (r *GatewayReconciler) updateAddressesAndListenersStatus(
// different protocols anyway
func mergeAllowedRoutes(source, target []gatewayv1alpha2.Listener) []gatewayv1alpha2.Listener {
var result []gatewayv1alpha2.Listener
mappings := make(map[gatewayv1alpha2.ProtocolType]gatewayv1alpha2.RouteNamespaces)
mappings := make(map[gatewayv1alpha2.ProtocolType]gatewayv1alpha2.RouteNamespaces, 0, len(target))
for _, listener := range source {
mappings[listener.Protocol] = *listener.AllowedRoutes.Namespaces
}
Expand Down
10 changes: 5 additions & 5 deletions test/integration/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ func TestGatewayFilters(t *testing.T) {
}
}()

t.Log("deploying a gateway that only allows routes in all namespaces")
t.Log("deploying a gateway that allows routes in all namespaces")
fromSame := gatewayv1alpha2.NamespacesFromSame
fromAll := gatewayv1alpha2.NamespacesFromAll
fromSelector := gatewayv1alpha2.NamespacesFromSelector
Expand Down Expand Up @@ -498,7 +498,7 @@ func TestGatewayFilters(t *testing.T) {
require.NoError(t, err)

defer func() {
t.Logf("cleaning up the deployment %s", deployment.Name)
t.Logf("cleaning up deployments %s/%s and %s/%s", ns.Name, deployment.Name, other.Name, otherDeployment.Name)
if err := env.Cluster().Client().AppsV1().Deployments(ns.Name).Delete(ctx, deployment.Name, metav1.DeleteOptions{}); err != nil {
if !errors.IsNotFound(err) {
assert.NoError(t, err)
Expand All @@ -519,7 +519,7 @@ func TestGatewayFilters(t *testing.T) {
require.NoError(t, err)

defer func() {
t.Logf("cleaning up the service %s", service.Name)
t.Logf("cleaning up the services %s/%s and %s/%s", ns.Name, service.Name, other.Name, service.Name)
if err := env.Cluster().Client().CoreV1().Services(ns.Name).Delete(ctx, service.Name, metav1.DeleteOptions{}); err != nil {
if !errors.IsNotFound(err) {
assert.NoError(t, err)
Expand Down Expand Up @@ -629,7 +629,7 @@ func TestGatewayFilters(t *testing.T) {
_, err = c.GatewayV1alpha2().Gateways(ns.Name).Update(ctx, gw, metav1.UpdateOptions{})
require.NoError(t, err)

t.Log("confirming other namespace route becomes inacessible")
t.Log("confirming other namespace route becomes inaccessible")
eventuallyGETPath(t, "otherbin", http.StatusNotFound, "no Route matched", emptyHeaderSet)
t.Log("confirming same namespace route still operational")
eventuallyGETPath(t, "httpbin", http.StatusOK, "<title>httpbin.org</title>", emptyHeaderSet)
Expand Down Expand Up @@ -674,7 +674,7 @@ func TestGatewayFilters(t *testing.T) {
_, err = c.GatewayV1alpha2().Gateways(ns.Name).Update(ctx, gw, metav1.UpdateOptions{})
require.NoError(t, err)

t.Log("confirming wrong selector namespace route becomes inacesible")
t.Log("confirming wrong selector namespace route becomes inaccessible")
eventuallyGETPath(t, "httpbin", http.StatusNotFound, "no Route matched", emptyHeaderSet)
t.Log("confirming right selector namespace route becomes operational")
eventuallyGETPath(t, "otherbin", http.StatusOK, "<title>httpbin.org</title>", emptyHeaderSet)
Expand Down

0 comments on commit e335215

Please sign in to comment.