forked from hashicorp/consul
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Prop Override Envoy extension integration test (hashicorp#17569)
- Loading branch information
Showing
7 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
test/integration/connect/envoy/case-property-override/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,7 @@ | ||
#!/bin/bash | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
|
||
snapshot_envoy_admin localhost:19000 s1 primary || true | ||
snapshot_envoy_admin localhost:19001 s2 primary || true |
19 changes: 19 additions & 0 deletions
19
test/integration/connect/envoy/case-property-override/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,19 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
services { | ||
name = "s1" | ||
port = 8080 | ||
connect { | ||
sidecar_service { | ||
proxy { | ||
upstreams = [ | ||
{ | ||
destination_name = "s2" | ||
local_bind_port = 5000 | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
test/integration/connect/envoy/case-property-override/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,8 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
services { | ||
name = "s2" | ||
port = 8181 | ||
connect { sidecar_service {} } | ||
} |
57 changes: 57 additions & 0 deletions
57
test/integration/connect/envoy/case-property-override/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,57 @@ | ||
#!/bin/bash | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
|
||
set -eEuo pipefail | ||
|
||
upsert_config_entry primary ' | ||
Kind = "service-defaults" | ||
Name = "s2" | ||
Protocol = "http" | ||
EnvoyExtensions = [ | ||
{ | ||
Name = "builtin/property-override" | ||
Arguments = { | ||
ProxyType = "connect-proxy" | ||
Patches = [{ | ||
ResourceFilter = { | ||
ResourceType = "listener" | ||
TrafficDirection = "inbound" | ||
} | ||
Op = "add" | ||
Path = "/stat_prefix" | ||
Value = "custom.stats.s2" | ||
}] | ||
} | ||
} | ||
] | ||
' | ||
|
||
upsert_config_entry primary ' | ||
Kind = "service-defaults" | ||
Name = "s1" | ||
Protocol = "http" | ||
EnvoyExtensions = [ | ||
{ | ||
Name = "builtin/property-override" | ||
Arguments = { | ||
ProxyType = "connect-proxy" | ||
Patches = [{ | ||
ResourceFilter = { | ||
ResourceType = "cluster" | ||
TrafficDirection = "outbound" | ||
} | ||
Op = "add" | ||
Path = "/upstream_connection_options/tcp_keepalive/keepalive_probes" | ||
Value = 1234 | ||
}] | ||
} | ||
} | ||
] | ||
' | ||
|
||
register_services primary | ||
|
||
gen_envoy_bootstrap s1 19000 primary | ||
gen_envoy_bootstrap s2 19001 primary |
6 changes: 6 additions & 0 deletions
6
test/integration/connect/envoy/case-property-override/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,6 @@ | ||
#!/bin/bash | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
|
||
export REQUIRED_SERVICES="s1 s1-sidecar-proxy s2 s2-sidecar-proxy" |
29 changes: 29 additions & 0 deletions
29
test/integration/connect/envoy/case-property-override/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,29 @@ | ||
#!/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 "s2 proxy admin is up on :19001" { | ||
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 "s1 proxy is configured with the expected envoy patches" { | ||
run get_envoy_cluster_config localhost:19000 s2 | ||
[ "$status" == 0 ] | ||
|
||
[ "$(echo "$output" | jq -r '.upstream_connection_options.tcp_keepalive.keepalive_probes')" == "1234" ] | ||
} | ||
|
||
@test "s2 proxy is configured with the expected envoy patches" { | ||
run get_envoy_public_listener_once localhost:19001 | ||
[ "$status" == 0 ] | ||
|
||
[ "$(echo "$output" | jq -r '.active_state.listener.stat_prefix')" == "custom.stats.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