Skip to content

Commit

Permalink
Inline function calls for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancoleman committed May 3, 2024
1 parent e7ec36e commit 03d1d26
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions control-plane/api-gateway/controllers/gateway_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"testing"

mapset "github.com/deckarep/golang-set"

"github.com/hashicorp/consul-k8s/control-plane/api-gateway/common"
"github.com/hashicorp/consul-k8s/control-plane/api/v1alpha1"
"github.com/hashicorp/consul-k8s/control-plane/connect-inject/constants"
Expand Down Expand Up @@ -269,8 +270,7 @@ func TestTransformEndpoints(t *testing.T) {
allowK8sNamespacesSet: allowSet,
}

fn := controller.transformEndpoints
require.ElementsMatch(t, tt.expected, fn(context.Background(), tt.endpoints))
require.ElementsMatch(t, tt.expected, controller.transformEndpoints(context.Background(), tt.endpoints))
})
}
}
Expand Down Expand Up @@ -409,8 +409,7 @@ func TestTransformHTTPRoute(t *testing.T) {
t.Run(name, func(t *testing.T) {
controller := GatewayController{}

fn := controller.transformHTTPRoute
require.ElementsMatch(t, tt.expected, fn(context.Background(), tt.route))
require.ElementsMatch(t, tt.expected, controller.transformHTTPRoute(context.Background(), tt.route))
})
}
}
Expand Down Expand Up @@ -549,8 +548,7 @@ func TestTransformTCPRoute(t *testing.T) {
t.Run(name, func(t *testing.T) {
controller := GatewayController{}

fn := controller.transformTCPRoute
require.ElementsMatch(t, tt.expected, fn(context.Background(), tt.route))
require.ElementsMatch(t, tt.expected, controller.transformTCPRoute(context.Background(), tt.route))
})
}
}
Expand Down Expand Up @@ -635,8 +633,7 @@ func TestTransformSecret(t *testing.T) {
Client: fakeClient,
}

fn := controller.transformSecret
require.ElementsMatch(t, tt.expected, fn(context.Background(), tt.secret))
require.ElementsMatch(t, tt.expected, controller.transformSecret(context.Background(), tt.secret))
})
}
}

0 comments on commit 03d1d26

Please sign in to comment.