-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[API Gateway] Add integration test for conflicted TCP listeners (#16225)
- Loading branch information
Andrew Stucki
authored
Feb 10, 2023
1 parent
4f2ce60
commit 318ba21
Showing
9 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/integration/connect/envoy/case-api-gateway-tcp-conflicted/capture.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
snapshot_envoy_admin localhost:20000 api-gateway primary || true |
4 changes: 4 additions & 0 deletions
4
test/integration/connect/envoy/case-api-gateway-tcp-conflicted/service_gateway.hcl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
services { | ||
name = "api-gateway" | ||
kind = "api-gateway" | ||
} |
50 changes: 50 additions & 0 deletions
50
test/integration/connect/envoy/case-api-gateway-tcp-conflicted/setup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
upsert_config_entry primary ' | ||
kind = "api-gateway" | ||
name = "api-gateway" | ||
listeners = [ | ||
{ | ||
port = 9999 | ||
protocol = "tcp" | ||
} | ||
] | ||
' | ||
|
||
upsert_config_entry primary ' | ||
kind = "tcp-route" | ||
name = "api-gateway-route-1" | ||
services = [ | ||
{ | ||
name = "s1" | ||
} | ||
] | ||
parents = [ | ||
{ | ||
name = "api-gateway" | ||
} | ||
] | ||
' | ||
|
||
upsert_config_entry primary ' | ||
kind = "tcp-route" | ||
name = "api-gateway-route-2" | ||
services = [ | ||
{ | ||
name = "s2" | ||
} | ||
] | ||
parents = [ | ||
{ | ||
name = "api-gateway" | ||
} | ||
] | ||
' | ||
|
||
register_services primary | ||
|
||
gen_envoy_bootstrap api-gateway 20000 primary true | ||
gen_envoy_bootstrap s1 19000 | ||
gen_envoy_bootstrap s2 19001 |
3 changes: 3 additions & 0 deletions
3
test/integration/connect/envoy/case-api-gateway-tcp-conflicted/vars.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
export REQUIRED_SERVICES="$DEFAULT_REQUIRED_SERVICES api-gateway-primary" |
20 changes: 20 additions & 0 deletions
20
test/integration/connect/envoy/case-api-gateway-tcp-conflicted/verify.bats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bats | ||
|
||
load helpers | ||
|
||
@test "api gateway proxy admin is up on :20000" { | ||
retry_default curl -f -s localhost:20000/stats -o /dev/null | ||
} | ||
|
||
@test "api gateway should have a conflicted status" { | ||
assert_config_entry_status Accepted True Accepted primary api-gateway api-gateway | ||
assert_config_entry_status Conflicted True RouteConflict primary api-gateway api-gateway | ||
} | ||
|
||
@test "api gateway should have no healthy endpoints for s1" { | ||
assert_upstream_missing 127.0.0.1:20000 s1 | ||
} | ||
|
||
@test "api gateway should have no healthy endpoints for s2" { | ||
assert_upstream_missing 127.0.0.1:20000 s2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters