From e335215d9a713dae193cd6892e50ba363b2d28bf Mon Sep 17 00:00:00 2001 From: Travis Raines <571832+rainest@users.noreply.github.com> Date: Fri, 15 Apr 2022 11:05:34 -0700 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Shane Utt --- internal/controllers/gateway/gateway_controller.go | 2 +- test/integration/gateway_test.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/controllers/gateway/gateway_controller.go b/internal/controllers/gateway/gateway_controller.go index 3dd34c7a28..91ef389373 100644 --- a/internal/controllers/gateway/gateway_controller.go +++ b/internal/controllers/gateway/gateway_controller.go @@ -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 } diff --git a/test/integration/gateway_test.go b/test/integration/gateway_test.go index de264e9edb..164976157d 100644 --- a/test/integration/gateway_test.go +++ b/test/integration/gateway_test.go @@ -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 @@ -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) @@ -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) @@ -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, "httpbin.org", emptyHeaderSet) @@ -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, "httpbin.org", emptyHeaderSet)