-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add helm chart tests for gateway api routes (#345)
Signed-off-by: Lenin Mehedy <[email protected]> Co-authored-by: Nathan Klick <[email protected]>
- Loading branch information
1 parent
af2a8b8
commit 3936a64
Showing
11 changed files
with
264 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: pod-monitor | ||
name: pod-monitor | ||
namespace: {{ .Values.namespace }} |
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
121 changes: 121 additions & 0 deletions
121
charts/hedera-network/tests/test_gateway_api_deployment.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,121 @@ | ||
# bats file_tags=deployment-test | ||
setup() { | ||
source "$(dirname "${BATS_TEST_FILENAME}")/env.sh" | ||
source "${TESTS_DIR}/load.sh" | ||
} | ||
|
||
@test "Check Envoy Proxy GRPC-Web routes" { | ||
log_debug "----------------------------------------------------------------------------" | ||
log_debug "TEST: Checking Envoy Proxy GRPC-Web Route" | ||
log_debug "----------------------------------------------------------------------------" | ||
|
||
local resp="$(get_pod_list network-node)" | ||
local pods=(${resp}) # convert into an array | ||
log_debug "Network nodes: ${pods[*]}" | ||
|
||
local test_status="${FAIL}" | ||
local status_val="${EX_ERR}" | ||
if [[ "${#pods[@]}" -gt 0 ]]; then | ||
test_status="${PASS}" | ||
for pod in "${pods[@]}"; do | ||
log_debug "" | ||
local node_name=$(get_pod_label "${pod}" "fullstack.hedera.com/node-name") | ||
[[ -z "${node_name}" ]] && test_status="${FAIL}" && break | ||
|
||
local route_name="envoy-grpc-web-route-${node_name}" | ||
local is_enabled=$(is_enabled_for_node "${node_name}" ".envoyProxy.enable") | ||
if [ "${is_enabled}" = "TRUE" ]; then | ||
log_debug "EnvoyProxy enabled for node '${node_name}'" | ||
log_debug "Checking Envoy proxy httproute '${route_name}'" | ||
is_route_accepted "httproute" "${route_name}" || test_status="${FAIL}" | ||
[ "${test_status}" = "FAIL" ] && break | ||
else | ||
log_debug "EnvoyProxy is not enabled for node '${node_name}'. Skipped route check for '${route_name}'." | ||
fi | ||
done | ||
fi | ||
|
||
log_debug "" | ||
log_debug "[${test_status}] Envoy Proxy GRPC-Web Route Check" | ||
log_debug "" | ||
|
||
# assert success | ||
[[ "${test_status}" = "${PASS}" ]] | ||
} | ||
|
||
@test "Check HAProxy GRPC routes" { | ||
log_debug "----------------------------------------------------------------------------" | ||
log_debug "TEST: Checking HAProxy GRPC Route" | ||
log_debug "----------------------------------------------------------------------------" | ||
|
||
local resp="$(get_pod_list network-node)" | ||
local pods=(${resp}) # convert into an array | ||
log_debug "Network nodes: ${pods[*]}" | ||
|
||
local test_status="${FAIL}" | ||
local status_val="${EX_ERR}" | ||
if [[ "${#pods[@]}" -gt 0 ]]; then | ||
test_status="${PASS}" | ||
for pod in "${pods[@]}"; do | ||
log_debug "" | ||
local node_name=$(get_pod_label "${pod}" "fullstack.hedera.com/node-name") | ||
[[ -z "${node_name}" ]] && test_status="${FAIL}" && break | ||
|
||
local route_name="haproxy-grpc-route-${node_name}" | ||
local is_enabled=$(is_enabled_for_node "${node_name}" ".haproxy.enable") | ||
if [ "${is_enabled}" = "TRUE" ]; then | ||
log_debug "HAProxy enabled for node '${node_name}'" | ||
log_debug "Checking HAProxy GRPC route '${route_name}'" | ||
is_route_accepted "tcproute" "${route_name}" || test_status="${FAIL}" | ||
[ "${test_status}" = "FAIL" ] && break | ||
else | ||
log_debug "HAProxy is not enabled for node '${node_name}'. Skipped route check for '${route_name}'." | ||
fi | ||
done | ||
fi | ||
|
||
log_debug "" | ||
log_debug "[${test_status}] HAProxy GRPC Route Check" | ||
log_debug "" | ||
|
||
# assert success | ||
[[ "${test_status}" = "${PASS}" ]] | ||
} | ||
|
||
@test "Check Network Node GRPC routes" { | ||
log_debug "----------------------------------------------------------------------------" | ||
log_debug "TEST: Checking Network Node GRPC Route" | ||
log_debug "----------------------------------------------------------------------------" | ||
|
||
local resp="$(get_pod_list network-node)" | ||
local pods=(${resp}) # convert into an array | ||
log_debug "Network nodes: ${pods[*]}" | ||
|
||
local test_status="${FAIL}" | ||
local status_val="${EX_ERR}" | ||
if [[ "${#pods[@]}" -gt 0 ]]; then | ||
test_status="${PASS}" | ||
for pod in "${pods[@]}"; do | ||
log_debug "" | ||
local node_name=$(get_pod_label "${pod}" "fullstack.hedera.com/node-name") | ||
[[ -z "${node_name}" ]] && test_status="${FAIL}" && break | ||
|
||
local route_name="node-grpc-route-${node_name}" | ||
local is_enabled=$(is_enabled_for_node "${node_name}" ".haproxy.enable") | ||
if [ "${is_enabled}" = "FALSE" ]; then | ||
log_debug "Checking Node GRPC route '${route_name}'" | ||
is_route_accepted "tcproute" "${route_name}" || test_status="${FAIL}" | ||
[ "${test_status}" = "FAIL" ] && break | ||
else | ||
log_debug "HAProxy enabled for node '${node_name}'. Skipped route check for '${route_name}'." | ||
fi | ||
done | ||
fi | ||
|
||
log_debug "" | ||
log_debug "[${test_status}] Node GRPC Route Check" | ||
log_debug "" | ||
|
||
# assert success | ||
[[ "${test_status}" = "${PASS}" ]] | ||
} |
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
Oops, something went wrong.