-
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 peering integration tests (#14836)
Add peering integration tests.
- Loading branch information
1 parent
1b56544
commit 678adb3
Showing
49 changed files
with
843 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/alpha/base.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,5 @@ | ||
primary_datacenter = "alpha" | ||
log_level = "trace" | ||
peering { | ||
enabled = true | ||
} |
26 changes: 26 additions & 0 deletions
26
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/alpha/config_entries.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,26 @@ | ||
config_entries { | ||
bootstrap = [ | ||
{ | ||
kind = "proxy-defaults" | ||
name = "global" | ||
|
||
config { | ||
protocol = "tcp" | ||
} | ||
}, | ||
{ | ||
kind = "exported-services" | ||
name = "default" | ||
services = [ | ||
{ | ||
name = "s2" | ||
consumers = [ | ||
{ | ||
peer_name = "alpha-to-primary" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/alpha/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,5 @@ | ||
services { | ||
name = "mesh-gateway" | ||
kind = "mesh-gateway" | ||
port = 4432 | ||
} |
1 change: 1 addition & 0 deletions
1
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/alpha/service_s1.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 @@ | ||
# We don't want an s1 service in this peer |
10 changes: 10 additions & 0 deletions
10
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/alpha/service_s2.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,10 @@ | ||
services { | ||
name = "s2" | ||
port = 8181 | ||
checks = [] | ||
connect { | ||
sidecar_service { | ||
checks = [] | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/alpha/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,11 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
register_services alpha | ||
|
||
gen_envoy_bootstrap s2 19002 alpha | ||
gen_envoy_bootstrap mesh-gateway 19003 alpha true | ||
|
||
wait_for_config_entry proxy-defaults global alpha | ||
wait_for_config_entry exported-services default alpha |
27 changes: 27 additions & 0 deletions
27
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/alpha/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,27 @@ | ||
#!/usr/bin/env bats | ||
|
||
load helpers | ||
|
||
@test "s2 proxy is running correct version" { | ||
assert_envoy_version 19002 | ||
} | ||
|
||
@test "s2 proxy admin is up on :19002" { | ||
retry_default curl -f -s localhost:19002/stats -o /dev/null | ||
} | ||
|
||
@test "gateway-alpha proxy admin is up on :19003" { | ||
retry_default curl -f -s localhost:19003/stats -o /dev/null | ||
} | ||
|
||
@test "s2 proxy listener should be up and have right cert" { | ||
assert_proxy_presents_cert_uri localhost:21000 s2 alpha | ||
} | ||
|
||
@test "s2 proxy should be healthy" { | ||
assert_service_has_healthy_instances s2 1 alpha | ||
} | ||
|
||
@test "gateway-alpha should be up and listening" { | ||
retry_long nc -z consul-alpha-client:4432 | ||
} |
2 changes: 2 additions & 0 deletions
2
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/bind.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,2 @@ | ||
bind_addr = "0.0.0.0" | ||
advertise_addr = "{{ GetInterfaceIP \"eth0\" }}" |
6 changes: 6 additions & 0 deletions
6
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/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,6 @@ | ||
#!/bin/bash | ||
|
||
snapshot_envoy_admin localhost:19000 s1 primary || true | ||
snapshot_envoy_admin localhost:19001 s2 primary || true | ||
snapshot_envoy_admin localhost:19002 s2 alpha || true | ||
snapshot_envoy_admin localhost:19003 mesh-gateway alpha || true |
3 changes: 3 additions & 0 deletions
3
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/primary/base.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,3 @@ | ||
peering { | ||
enabled = true | ||
} |
53 changes: 53 additions & 0 deletions
53
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/primary/config_entries.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,53 @@ | ||
config_entries { | ||
bootstrap { | ||
kind = "proxy-defaults" | ||
name = "global" | ||
|
||
config { | ||
protocol = "http" | ||
} | ||
} | ||
|
||
bootstrap { | ||
kind = "service-splitter" | ||
name = "split-s2" | ||
splits = [ | ||
{ | ||
Weight = 50 | ||
Service = "local-s2" | ||
ResponseHeaders { | ||
Set { | ||
"x-test-split" = "primary" | ||
} | ||
} | ||
}, | ||
{ | ||
Weight = 50 | ||
Service = "peer-s2" | ||
ResponseHeaders { | ||
Set { | ||
"x-test-split" = "alpha" | ||
} | ||
} | ||
}, | ||
] | ||
} | ||
|
||
bootstrap { | ||
kind = "service-resolver" | ||
name = "local-s2" | ||
redirect = { | ||
service = "s2" | ||
} | ||
} | ||
|
||
bootstrap { | ||
kind = "service-resolver" | ||
name = "peer-s2" | ||
|
||
redirect = { | ||
service = "s2" | ||
peer = "primary-to-alpha" | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/primary/service_s1.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,22 @@ | ||
services { | ||
name = "s1" | ||
port = 8080 | ||
checks = [] | ||
connect { | ||
sidecar_service { | ||
checks = [] | ||
proxy { | ||
upstreams = [ | ||
{ | ||
destination_name = "split-s2" | ||
local_bind_port = 5000 | ||
}, | ||
{ | ||
destination_name = "peer-s2" | ||
local_bind_port = 5001 | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/primary/service_s2.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,10 @@ | ||
services { | ||
name = "s2" | ||
port = 8181 | ||
checks = [] | ||
connect { | ||
sidecar_service { | ||
checks = [] | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/primary/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,10 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
register_services primary | ||
|
||
gen_envoy_bootstrap s1 19000 primary | ||
gen_envoy_bootstrap s2 19001 primary | ||
|
||
wait_for_config_entry proxy-defaults global |
74 changes: 74 additions & 0 deletions
74
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/primary/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,74 @@ | ||
#!/usr/bin/env bats | ||
|
||
load helpers | ||
|
||
@test "s1 proxy is running correct version" { | ||
assert_envoy_version 19000 | ||
} | ||
|
||
@test "s1 proxy admin is up" { | ||
retry_default curl -f -s localhost:19000/stats -o /dev/null | ||
} | ||
|
||
@test "s2 proxy admin is up" { | ||
retry_default curl -f -s localhost:19001/stats -o /dev/null | ||
} | ||
|
||
@test "s1 proxy listener should be up and have right cert" { | ||
assert_proxy_presents_cert_uri localhost:21000 s1 | ||
} | ||
|
||
@test "s2 proxies should be healthy in primary" { | ||
assert_service_has_healthy_instances s2 1 primary | ||
} | ||
|
||
@test "s2 proxies should be healthy in alpha" { | ||
assert_service_has_healthy_instances s2 1 alpha | ||
} | ||
|
||
@test "gateway-alpha should be up and listening" { | ||
retry_long nc -z consul-alpha-client:4432 | ||
} | ||
|
||
@test "peer the two clusters together" { | ||
create_peering primary alpha | ||
} | ||
|
||
@test "s2 alpha proxies should be healthy in primary" { | ||
assert_service_has_healthy_instances s2 1 primary "" "" primary-to-alpha | ||
} | ||
|
||
@test "s1 upstream should have healthy endpoints for s2 primary and alpha" { | ||
assert_upstream_has_endpoints_in_status 127.0.0.1:19000 s2.default.primary.internal HEALTHY 1 | ||
assert_upstream_has_endpoints_in_status 127.0.0.1:19000 s2.default.primary-to-alpha.external HEALTHY 1 | ||
} | ||
|
||
@test "s1 upstream should be split between peer and local dc" { | ||
retry_long assert_url_header "http://127.0.0.1:5000/" "x-test-split" "primary" | ||
[ "$status" -eq 0 ] | ||
retry_long assert_url_header "http://127.0.0.1:5000/" "x-test-split" "alpha" | ||
[ "$status" -eq 0 ] | ||
retry_long assert_expected_fortio_name s2 127.0.0.1 5000 | ||
retry_long assert_expected_fortio_name s2-alpha 127.0.0.1 5000 | ||
} | ||
|
||
@test "s1 upstream made 2 connections to primary s2 split" { | ||
retry_long assert_envoy_metric_at_least 127.0.0.1:19000 "cluster.s2.default.primary.internal.*upstream_rq_total" 1 | ||
} | ||
|
||
@test "s1 upstream made 2 connections to alpha s2 split" { | ||
retry_long assert_envoy_metric_at_least 127.0.0.1:19000 "cluster.s2.default.primary-to-alpha.external.*upstream_rq_total" 1 | ||
} | ||
|
||
@test "reset envoy statistics" { | ||
reset_envoy_metrics 127.0.0.1:19000 | ||
retry_long assert_envoy_metric 127.0.0.1:19000 "cluster.s2.default.primary-to-alpha.external.*upstream_rq_total" 0 | ||
} | ||
|
||
@test "s1 upstream should be able to connect to s2 via peer-s2" { | ||
assert_expected_fortio_name s2-alpha 127.0.0.1 5001 | ||
} | ||
|
||
@test "s1 upstream made 1 connection to s2 via peer-s2" { | ||
retry_long assert_envoy_metric_at_least 127.0.0.1:19000 "http.upstream.peer-s2.default.default.primary.rq_total" 1 | ||
} |
4 changes: 4 additions & 0 deletions
4
test/integration/connect/envoy/case-cfg-splitter-cluster-peering/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,4 @@ | ||
#!/bin/bash | ||
|
||
export REQUIRED_SERVICES="s1 s1-sidecar-proxy s2 s2-sidecar-proxy s2-alpha s2-sidecar-proxy-alpha gateway-alpha" | ||
export REQUIRE_PEERS=1 |
5 changes: 5 additions & 0 deletions
5
test/integration/connect/envoy/case-cfg-splitter-peering-ingress-gateways/alpha/base.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,5 @@ | ||
primary_datacenter = "alpha" | ||
log_level = "trace" | ||
peering { | ||
enabled = true | ||
} |
34 changes: 34 additions & 0 deletions
34
...gration/connect/envoy/case-cfg-splitter-peering-ingress-gateways/alpha/config_entries.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,34 @@ | ||
config_entries { | ||
bootstrap = [ | ||
{ | ||
kind = "proxy-defaults" | ||
name = "global" | ||
|
||
config { | ||
protocol = "tcp" | ||
} | ||
}, | ||
{ | ||
kind = "exported-services" | ||
name = "default" | ||
services = [ | ||
{ | ||
name = "s1" | ||
consumers = [ | ||
{ | ||
peer_name = "alpha-to-primary" | ||
} | ||
] | ||
}, | ||
{ | ||
name = "s2" | ||
consumers = [ | ||
{ | ||
peer_name = "alpha-to-primary" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
...ration/connect/envoy/case-cfg-splitter-peering-ingress-gateways/alpha/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,5 @@ | ||
services { | ||
name = "mesh-gateway" | ||
kind = "mesh-gateway" | ||
port = 4432 | ||
} |
10 changes: 10 additions & 0 deletions
10
...integration/connect/envoy/case-cfg-splitter-peering-ingress-gateways/alpha/service_s1.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,10 @@ | ||
services { | ||
name = "s1" | ||
port = 8080 | ||
checks = [] | ||
connect { | ||
sidecar_service { | ||
checks = [] | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...integration/connect/envoy/case-cfg-splitter-peering-ingress-gateways/alpha/service_s2.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,10 @@ | ||
services { | ||
name = "s2" | ||
port = 8181 | ||
checks = [] | ||
connect { | ||
sidecar_service { | ||
checks = [] | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
test/integration/connect/envoy/case-cfg-splitter-peering-ingress-gateways/alpha/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,12 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
wait_for_config_entry proxy-defaults global alpha | ||
wait_for_config_entry exported-services default alpha | ||
|
||
register_services alpha | ||
|
||
gen_envoy_bootstrap s1 19001 alpha | ||
gen_envoy_bootstrap s2 19002 alpha | ||
gen_envoy_bootstrap mesh-gateway 19003 alpha true |
Oops, something went wrong.