Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangpengcheng committed Feb 26, 2024
1 parent f02a16c commit 86337f4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions .ci/clusters/global_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ metadata:
name: mesh-global-env
data:
global1: globalvalue1
shared1: fromglobal
1 change: 0 additions & 1 deletion .ci/tests/global.env

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ metadata:
namespace: default
data:
namespaced1: namespacedvalue1
shared1: fromnamespace
16 changes: 16 additions & 0 deletions .ci/tests/integration/cases/global-and-namespaced-env/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ if [ $? -ne 0 ]; then
exit 1
fi

# if global and namespaced env has same key, the value from namespace should be used
verify_env_result=$(ci::verify_env "function-sample-env" shared1 shared1=fromnamespace 2>&1)
if [ $? -ne 0 ]; then
echo "$verify_env_result"
kubectl delete -f "${env_file}" > /dev/null 2>&1
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true
exit 1
fi

kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true

# delete the namespaced env, the function can start successfully but without namespaced env injected
Expand All @@ -81,6 +90,13 @@ if [ $? -ne 0 ]; then
exit 1
fi

verify_env_result=$(ci::verify_env "function-sample-env" shared1 shared1=fromglobal 2>&1)
if [ $? -ne 0 ]; then
echo "$verify_env_result"
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true
exit 1
fi

verify_env_result=$(ci::verify_env "function-sample-env" namespaced1 "" 2>&1)
if [ $? -eq 0 ]; then
echo "e2e-test: ok" | yq eval -
Expand Down

0 comments on commit 86337f4

Please sign in to comment.