Skip to content

Commit

Permalink
fix syntax issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahalsmiller committed Feb 22, 2023
1 parent 194c31a commit aab4112
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ func TestAPIGatewayCreate(t *testing.T) {
return gatewayReady && routeReady
}, time.Second*10, time.Second*1)

libassert.HTTPServiceEchoes(t, "localhost", gatewayService.GetPort(listenerPortOne), "")
port, err := gatewayService.GetPort(listenerPortOne)
assert.NoError(t, err)
libassert.HTTPServiceEchoes(t, "localhost", port, "")
}

func isAccepted(conditions []api.Condition) bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ func TestHTTPRouteFlattening(t *testing.T) {
//gateway resolves routes

ip := "localhost"
gatewayPort := gatewayService.GetPort(listenerPort)
gatewayPort, err := gatewayService.GetPort(listenerPort)
assert.NoError(t, err)

//route 2 with headers

Expand All @@ -237,23 +238,23 @@ func TestHTTPRouteFlattening(t *testing.T) {
}, checkOptions{statusCode: service2ResponseCode, testName: "service2 just path match"})

////v1 path with the header
checkRoute(t, ip, gatewayService.GetPort(listenerPort), "check", map[string]string{
checkRoute(t, ip, gatewayPort, "check", map[string]string{
"Host": "test.foo",
"x-v2": "v2",
}, checkOptions{statusCode: service2ResponseCode, testName: "service2 just header match"})

checkRoute(t, ip, gatewayService.GetPort(listenerPort), "v2/path/value", map[string]string{
checkRoute(t, ip, gatewayPort, "v2/path/value", map[string]string{
"Host": "test.foo",
"x-v2": "v2",
}, checkOptions{statusCode: service2ResponseCode, testName: "service2 v2 with path"})

//hit service 1 by hitting root path
checkRoute(t, ip, gatewayService.GetPort(listenerPort), "", map[string]string{
checkRoute(t, ip, gatewayPort, "", map[string]string{
"Host": "test.foo",
}, checkOptions{debug: false, statusCode: service1ResponseCode, testName: "service1 root prefix"})

//hit service 1 by hitting v2 path with v1 hostname
checkRoute(t, ip, gatewayService.GetPort(listenerPort), "v2", map[string]string{
checkRoute(t, ip, gatewayPort, "v2", map[string]string{
"Host": "test.example",
}, checkOptions{debug: false, statusCode: service1ResponseCode, testName: "service1, v2 path with v2 hostname"})

Expand Down

0 comments on commit aab4112

Please sign in to comment.