@@ -23,6 +23,7 @@ import (
23
23
24
24
"github.com/google/go-cmp/cmp"
25
25
26
+ "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/backend"
26
27
logutil "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/util/logging"
27
28
)
28
29
@@ -59,6 +60,27 @@ data: [DONE]
59
60
`
60
61
)
61
62
63
+ type mockDirector struct {}
64
+
65
+ func (m * mockDirector ) HandleResponseBodyStreaming (ctx context.Context , reqCtx * RequestContext ) (* RequestContext , error ) {
66
+ return reqCtx , nil
67
+ }
68
+ func (m * mockDirector ) HandleResponseBodyComplete (ctx context.Context , reqCtx * RequestContext ) (* RequestContext , error ) {
69
+ return reqCtx , nil
70
+ }
71
+ func (m * mockDirector ) HandleResponseReceived (ctx context.Context , reqCtx * RequestContext ) (* RequestContext , error ) {
72
+ return reqCtx , nil
73
+ }
74
+ func (m * mockDirector ) HandlePreRequest (ctx context.Context , reqCtx * RequestContext ) (* RequestContext , error ) {
75
+ return reqCtx , nil
76
+ }
77
+ func (m * mockDirector ) GetRandomPod () * backend.Pod {
78
+ return & backend.Pod {}
79
+ }
80
+ func (m * mockDirector ) HandleRequest (ctx context.Context , reqCtx * RequestContext ) (* RequestContext , error ) {
81
+ return reqCtx , nil
82
+ }
83
+
62
84
func TestHandleResponseBody (t * testing.T ) {
63
85
ctx := logutil .NewTestLoggerIntoContext (context .Background ())
64
86
@@ -83,6 +105,7 @@ func TestHandleResponseBody(t *testing.T) {
83
105
for _ , test := range tests {
84
106
t .Run (test .name , func (t * testing.T ) {
85
107
server := & StreamingServer {}
108
+ server .director = & mockDirector {}
86
109
reqCtx := test .reqCtx
87
110
if reqCtx == nil {
88
111
reqCtx = & RequestContext {}
@@ -143,6 +166,7 @@ func TestHandleStreamedResponseBody(t *testing.T) {
143
166
for _ , test := range tests {
144
167
t .Run (test .name , func (t * testing.T ) {
145
168
server := & StreamingServer {}
169
+ server .director = & mockDirector {}
146
170
reqCtx := test .reqCtx
147
171
if reqCtx == nil {
148
172
reqCtx = & RequestContext {}
0 commit comments