Skip to content

Commit b37aa1c

Browse files
committed
fixed failing test
Signed-off-by: Nir Rozenbaum <[email protected]>
1 parent 9ef0534 commit b37aa1c

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

pkg/epp/server/server_test.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,10 @@ const (
4242
)
4343

4444
func TestServer(t *testing.T) {
45-
theHeaderValue := "body"
46-
requestHeader := "x-test"
47-
4845
expectedRequestHeaders := map[string]string{metadata.DestinationEndpointKey: fmt.Sprintf("%s:%d", podAddress, poolPort),
49-
"Content-Length": "42", ":method": "POST", requestHeader: theHeaderValue}
50-
expectedResponseHeaders := map[string]string{"x-went-into-resp-headers": "true", ":method": "POST", requestHeader: theHeaderValue}
51-
expectedSchedulerHeaders := map[string]string{":method": "POST", requestHeader: theHeaderValue}
46+
"Content-Length": "42", ":method": "POST", "x-test": "body", "x-request-id": "test-request-id"}
47+
expectedResponseHeaders := map[string]string{"x-went-into-resp-headers": "true", ":method": "POST", "x-test": "body"}
48+
expectedSchedulerHeaders := map[string]string{":method": "POST", "x-test": "body", "x-request-id": "test-request-id"}
5249

5350
t.Run("server", func(t *testing.T) {
5451
model := testutil.MakeInferenceObjective("v1").
@@ -66,9 +63,10 @@ func TestServer(t *testing.T) {
6663

6764
// Send request headers - no response expected
6865
headers := utils.BuildEnvoyGRPCHeaders(map[string]string{
69-
requestHeader: theHeaderValue,
66+
"x-test": "body",
7067
":method": "POST",
7168
metadata.FlowFairnessIDKey: "a-very-interesting-fairness-id",
69+
"x-request-id": "test-request-id",
7270
}, true)
7371
request := &pb.ProcessingRequest{
7472
Request: &pb.ProcessingRequest_RequestHeaders{
@@ -130,9 +128,6 @@ func TestServer(t *testing.T) {
130128
}
131129

132130
// Check headers passed to the scheduler
133-
if len(director.requestHeaders) != 2 {
134-
t.Errorf("Incorrect number of request headers %d instead of 2", len(director.requestHeaders))
135-
}
136131
for expectedKey, expectedValue := range expectedSchedulerHeaders {
137132
got, ok := director.requestHeaders[expectedKey]
138133
if !ok {
@@ -143,7 +138,7 @@ func TestServer(t *testing.T) {
143138
}
144139

145140
// Send response headers
146-
headers = utils.BuildEnvoyGRPCHeaders(map[string]string{requestHeader: theHeaderValue, ":method": "POST"}, false)
141+
headers = utils.BuildEnvoyGRPCHeaders(map[string]string{"x-test": "body", ":method": "POST"}, false)
147142
request = &pb.ProcessingRequest{
148143
Request: &pb.ProcessingRequest_ResponseHeaders{
149144
ResponseHeaders: headers,

0 commit comments

Comments
 (0)