Skip to content

Commit

Permalink
Updates tcproute translator unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Daneyon Hansen <[email protected]>
  • Loading branch information
danehans committed Nov 21, 2024
1 parent 54b52e2 commit 06d09b8
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 44 deletions.
6 changes: 6 additions & 0 deletions changelog/v1.18.0-rc2/issue_10365.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
changelog:
- type: FIX
issueLink: https://github.com/k8sgateway/k8sgateway/issues/10365
resolvesIssue: true
description: >-
Adds support for setting TCPRoute status and managing status conditions.
2 changes: 2 additions & 0 deletions projects/gateway2/query/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"github.com/solo-io/gloo/projects/gateway2/wellknown"
)

//go:generate go run github.com/golang/mock/mockgen -destination mocks/mock_queries.go -package mocks github.com/solo-io/gloo/projects/gateway2/query GatewayQueries

var _ = Describe("Query", func() {
var (
scheme *runtime.Scheme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func mergeGWListeners(
) *MergedListeners {
ml := &MergedListeners{
parentGw: parentGw,
gatewayNamespace: gatewayNamespace,
queries: queries,
GatewayNamespace: gatewayNamespace,
Queries: queries,
}
for _, listener := range listeners {
result, ok := routesForGw.ListenerResults[string(listener.Name)]
Expand All @@ -76,10 +76,10 @@ func mergeGWListeners(
}

type MergedListeners struct {
gatewayNamespace string
GatewayNamespace string
parentGw gwv1.Gateway
Listeners []*MergedListener
queries query.GatewayQueries
Queries query.GatewayQueries
}

func (ml *MergedListeners) AppendListener(
Expand Down Expand Up @@ -135,7 +135,7 @@ func (ml *MergedListeners) appendHttpListener(
// create a new filter chain for the listener
ml.Listeners = append(ml.Listeners, &MergedListener{
name: listenerName,
gatewayNamespace: ml.gatewayNamespace,
gatewayNamespace: ml.GatewayNamespace,
port: finalPort,
httpFilterChain: fc,
listenerReporter: reporter,
Expand All @@ -155,7 +155,7 @@ func (ml *MergedListeners) appendHttpsListener(
sniDomain: listener.Hostname,
tls: listener.TLS,
routesWithHosts: routesWithHosts,
queries: ml.queries,
queries: ml.Queries,
}

// Perform the port transformation away from privileged ports only once to use
Expand All @@ -174,7 +174,7 @@ func (ml *MergedListeners) appendHttpsListener(
}
ml.Listeners = append(ml.Listeners, &MergedListener{
name: listenerName,
gatewayNamespace: ml.gatewayNamespace,
gatewayNamespace: ml.GatewayNamespace,
port: finalPort,
httpsFilterChains: []httpsFilterChain{mfc},
listenerReporter: reporter,
Expand Down Expand Up @@ -236,7 +236,7 @@ func (ml *MergedListeners) AppendTcpListener(
// create a new filter chain for the listener
ml.Listeners = append(ml.Listeners, &MergedListener{
name: listenerName,
gatewayNamespace: ml.gatewayNamespace,
gatewayNamespace: ml.GatewayNamespace,
port: finalPort,
TcpFilterChains: []tcpFilterChain{fc},
listenerReporter: reporter,
Expand Down Expand Up @@ -331,7 +331,7 @@ func buildTcpHost(
} else if len(weightedDestinations) == 1 {
tcpHost.Destination = &v1.TcpHost_TcpAction{
Destination: &v1.TcpHost_TcpAction_Single{
Single: weightedDestinations[0].Destination,
Single: weightedDestinations[0].GetDestination(),
},
}
} else {
Expand Down
Loading

0 comments on commit 06d09b8

Please sign in to comment.