-
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.
Add integration test for cleaning up resolvers
- Loading branch information
Andrew Stucki
committed
Mar 2, 2023
1 parent
e14b430
commit 5255013
Showing
8 changed files
with
146 additions
and
2 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
test/integration/connect/envoy/case-terminating-gateway-deleted-resolver/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,4 @@ | ||
#!/bin/bash | ||
|
||
snapshot_envoy_admin localhost:20000 terminating-gateway primary || true | ||
snapshot_envoy_admin localhost:19000 s1 primary || true |
9 changes: 9 additions & 0 deletions
9
test/integration/connect/envoy/case-terminating-gateway-deleted-resolver/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,9 @@ | ||
services { | ||
name = "terminating-gateway" | ||
kind = "terminating-gateway" | ||
port = 8443 | ||
|
||
meta { | ||
version = "v1" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
test/integration/connect/envoy/case-terminating-gateway-deleted-resolver/service_s2-v1.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,9 @@ | ||
services { | ||
id = "s2-v1" | ||
name = "s2" | ||
port = 8182 | ||
|
||
meta { | ||
version = "v1" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
test/integration/connect/envoy/case-terminating-gateway-deleted-resolver/service_s2-v2.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,9 @@ | ||
services { | ||
id = "s2-v2" | ||
name = "s2" | ||
port = 8183 | ||
|
||
meta { | ||
version = "v2" | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
test/integration/connect/envoy/case-terminating-gateway-deleted-resolver/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,41 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
upsert_config_entry primary ' | ||
kind = "terminating-gateway" | ||
name = "terminating-gateway" | ||
services = [ | ||
{ | ||
name = "s2" | ||
} | ||
] | ||
' | ||
|
||
upsert_config_entry primary ' | ||
kind = "proxy-defaults" | ||
name = "global" | ||
config { | ||
protocol = "http" | ||
} | ||
' | ||
|
||
upsert_config_entry primary ' | ||
kind = "service-resolver" | ||
name = "s2" | ||
default_subset = "v1" | ||
subsets = { | ||
"v1" = { | ||
filter = "Service.Meta.version == v1" | ||
} | ||
"v2" = { | ||
filter = "Service.Meta.version == v2" | ||
} | ||
} | ||
' | ||
|
||
register_services primary | ||
|
||
# terminating gateway will act as s2's proxy | ||
gen_envoy_bootstrap s1 19000 | ||
gen_envoy_bootstrap terminating-gateway 20000 primary true |
8 changes: 8 additions & 0 deletions
8
test/integration/connect/envoy/case-terminating-gateway-deleted-resolver/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,8 @@ | ||
#!/bin/bash | ||
|
||
# There is no sidecar proxy for s2-v1, since the terminating gateway acts as the proxy | ||
export REQUIRED_SERVICES=" | ||
s1 s1-sidecar-proxy | ||
s2-v1 | ||
terminating-gateway-primary | ||
" |
50 changes: 50 additions & 0 deletions
50
test/integration/connect/envoy/case-terminating-gateway-deleted-resolver/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,50 @@ | ||
#!/usr/bin/env bats | ||
|
||
load helpers | ||
|
||
@test "s1 proxy admin is up on :19000" { | ||
retry_default curl -f -s localhost:19000/stats -o /dev/null | ||
} | ||
|
||
@test "terminating proxy admin is up on :20000" { | ||
retry_default curl -f -s localhost:20000/stats -o /dev/null | ||
} | ||
|
||
@test "terminating-gateway-primary listener is up on :8443" { | ||
retry_default nc -z localhost:8443 | ||
} | ||
|
||
@test "s1 proxy listener should be up and have right cert" { | ||
assert_proxy_presents_cert_uri localhost:21000 s1 | ||
} | ||
|
||
@test "s1 upstream should have healthy endpoints for v1.s2" { | ||
assert_upstream_has_endpoints_in_status 127.0.0.1:19000 v1.s2 HEALTHY 1 | ||
} | ||
|
||
@test "terminating-gateway should have healthy endpoints for v1.s2" { | ||
assert_upstream_has_endpoints_in_status 127.0.0.1:20000 v1.s2 HEALTHY 1 | ||
} | ||
|
||
@test "terminating-gateway should have healthy endpoints for v2.s2" { | ||
assert_upstream_has_endpoints_in_status 127.0.0.1:20000 v2.s2 HEALTHY 1 | ||
} | ||
|
||
@test "deleting the service-resolver should be possible" { | ||
delete_config_entry service-resolver s2 | ||
} | ||
|
||
@test "terminating gateway should no longer have v1.s2 endpoints" { | ||
assert_upstream_missing 127.0.0.1:20000 v1.s2 | ||
} | ||
|
||
@test "terminating gateway should no longer have v2.s2 endpoints" { | ||
assert_upstream_missing 127.0.0.1:20000 v2.s2 | ||
} | ||
|
||
@test "terminating gateway should still have s2 endpoints" { | ||
# expected 3 nodes here due to s1, s2, s2-v1, and s2-v2, the latter | ||
# all starting with "s2" | ||
assert_upstream_has_endpoints_in_status 127.0.0.1:20000 s2 HEALTHY 3 | ||
} | ||
|
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