Skip to content

Commit 4158658

Browse files
committed
corrected testing of return code
1 parent 928a672 commit 4158658

6 files changed

Lines changed: 20 additions & 14 deletions

File tree

tests/templates/kuttl/external-access/50-assert.yaml.j2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ commands:
2020
)
2121

2222
# Log-Endpoint Test Assertion:
23-
echo "The HTTP Code should be 403 to indicate the log server is reachable (the internal JWT token is needed for full access): $CURL_RESPONSE" | grep 403
23+
echo "The HTTP Code is $CURL_RESPONSE (an internal JWT token is needed for full access)"
24+
[ "$CURL_RESPONSE" -eq 403 ]
2425
{% endif %}

tests/templates/kuttl/ldap/95-assert.yaml.j2

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ commands:
1313
# This is executed from the Webserver as JWT keys must be present.
1414
# A small server is started on each worker that serves the logs on its
1515
# 8793 port for the Webserver: we don't use the token as that is an
16-
# internal implementation, but check that the end-point is reachable,
16+
# internal implementation, but check that the endpoint is reachable,
1717
# indicated by a 403.
1818
CURL_RESPONSE=$(
1919
kubectl -n $NAMESPACE exec airflow-webserver-default-0 -- sh -c 'CODE=$(curl -s -o /dev/null -w "%{http_code}" http://airflow-worker-default-headless:8793 2>/dev/null || true);echo "$CODE"'
2020
)
2121

2222
# Log-Endpoint Test Assertion:
23-
echo "The HTTP Code should be 403 to indicate the log server is reachable (the internal JWT token is needed for full access): $CURL_RESPONSE" | grep 403
23+
echo "The HTTP Code is $CURL_RESPONSE (an internal JWT token is needed for full access)"
24+
[ "$CURL_RESPONSE" -eq 403 ]
2425
{% endif %}

tests/templates/kuttl/logging/70-assert.yaml.j2

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,20 @@ commands:
1313
# This is executed from the Webserver as JWT keys must be present.
1414
# A small server is started on each worker that serves the logs on its
1515
# 8793 port for the Webserver: we don't use the token as that is an
16-
# internal implementation, but check that the end-point is reachable,
16+
# internal implementation, but check that the endpoint is reachable,
1717
# indicated by a 403.
1818
# Rolegroup custom-log-config
19-
CURL_RESPONSE=$(
19+
CURL_RESPONSE_CUSTOM=$(
2020
kubectl -n $NAMESPACE exec airflow-webserver-custom-log-config-0 -- sh -c 'CODE=$(curl -s -o /dev/null -w "%{http_code}" http://airflow-worker-custom-log-config-headless:8793 2>/dev/null || true);echo "$CODE"'
2121
)
2222

2323
# Log-Endpoint Test Assertions:
24-
echo "The HTTP Code should be 403 to indicate the log server is reachable (the internal JWT token is needed for full access): $CURL_RESPONSE" | grep 403
24+
echo "The HTTP Code is $CURL_RESPONSE_CUSTOM (an internal JWT token is needed for full access)"
2525

2626
# Rolegroup automatic-log-config
27-
CURL_RESPONSE=$(
27+
CURL_RESPONSE_AUTO=$(
2828
kubectl -n $NAMESPACE exec airflow-webserver-automatic-log-config-0 -- sh -c 'CODE=$(curl -s -o /dev/null -w "%{http_code}" http://airflow-worker-automatic-log-config-headless:8793 2>/dev/null || true);echo "$CODE"'
2929
)
30-
echo "The HTTP Code should be 403 to indicate the log server is reachable (the internal JWT token is needed for full access): $CURL_RESPONSE" | grep 403
30+
echo "The HTTP Code is $CURL_RESPONSE_AUTO (an internal JWT token is needed for full access)"
31+
[ "$CURL_RESPONSE_CUSTOM" -eq 403 ] && [ "$CURL_RESPONSE_AUTO" -eq 403 ]
3132
{% endif %}

tests/templates/kuttl/mount-dags-configmap/70-assert.yaml.j2

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ commands:
1313
# This is executed from the Webserver as JWT keys must be present.
1414
# A small server is started on each worker that serves the logs on its
1515
# 8793 port for the Webserver: we don't use the token as that is an
16-
# internal implementation, but check that the end-point is reachable,
16+
# internal implementation, but check that the endpoint is reachable,
1717
# indicated by a 403.
1818
CURL_RESPONSE=$(
1919
kubectl -n $NAMESPACE exec airflow-webserver-default-0 -- sh -c 'CODE=$(curl -s -o /dev/null -w "%{http_code}" http://airflow-worker-default-headless:8793 2>/dev/null || true);echo "$CODE"'
2020
)
2121

2222
# Log-Endpoint Test Assertion:
23-
echo "The HTTP Code should be 403 to indicate the log server is reachable (the internal JWT token is needed for full access): $CURL_RESPONSE" | grep 403
23+
echo "The HTTP Code is $CURL_RESPONSE (an internal JWT token is needed for full access)"
24+
[ "$CURL_RESPONSE" -eq 403 ]
2425
{% endif %}

tests/templates/kuttl/mount-dags-gitsync/70-assert.yaml.j2

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ commands:
1313
# This is executed from the Webserver as JWT keys must be present.
1414
# A small server is started on each worker that serves the logs on its
1515
# 8793 port for the Webserver: we don't use the token as that is an
16-
# internal implementation, but check that the end-point is reachable,
16+
# internal implementation, but check that the endpoint is reachable,
1717
# indicated by a 403.
1818
CURL_RESPONSE=$(
1919
kubectl -n $NAMESPACE exec airflow-webserver-default-0 -- sh -c 'CODE=$(curl -s -o /dev/null -w "%{http_code}" http://airflow-worker-default-headless:8793 2>/dev/null || true);echo "$CODE"'
2020
)
2121

2222
# Log-Endpoint Test Assertion:
23-
echo "The HTTP Code should be 403 to indicate the log server is reachable (the internal JWT token is needed for full access): $CURL_RESPONSE" | grep 403
23+
echo "The HTTP Code is $CURL_RESPONSE (an internal JWT token is needed for full access)"
24+
[ "$CURL_RESPONSE" -eq 403 ]
2425
{% endif %}

tests/templates/kuttl/smoke/80-assert.yaml.j2

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ commands:
1313
# This is executed from the Webserver as JWT keys must be present.
1414
# A small server is started on each worker that serves the logs on its
1515
# 8793 port for the Webserver: we don't use the token as that is an
16-
# internal implementation, but check that the end-point is reachable,
16+
# internal implementation, but check that the endpoint is reachable,
1717
# indicated by a 403.
1818
CURL_RESPONSE=$(
1919
kubectl -n $NAMESPACE exec airflow-webserver-default-0 -- sh -c 'CODE=$(curl -s -o /dev/null -w "%{http_code}" http://airflow-worker-default-headless:8793 2>/dev/null || true);echo "$CODE"'
2020
)
2121

2222
# Log-Endpoint Test Assertion:
23-
echo "The HTTP Code should be 403 to indicate the log server is reachable (the internal JWT token is needed for full access): $CURL_RESPONSE" | grep 403
23+
echo "The HTTP Code is $CURL_RESPONSE (an internal JWT token is needed for full access)"
24+
[ "$CURL_RESPONSE" -eq 403 ]
2425
{% endif %}

0 commit comments

Comments
 (0)