Files
fission-src/test/tests/test_namespace/test_ns_env.sh
T
neha_guptaandGitHub b9513868ed add namespace param for fn and env (#2556)
This PR moves fission CLI as closer as possible to kubectl command behaviour.  We have improved namespace handling behaviour across CLI.

* add namespace param for fn and env
* use common fn for ns check
* update validation
* default namespace for httpTrigger, env and package, config and triggers
* use default ns
* add namespace filter to spec
* add forceNamespace flag
* set current namespace
* add default namespace in config
* add namespace specific destroy
* add all namespace in the list of resources
* add namespace as global tag
* use %s instead of %v
* add test cases for namespace
* use ns in get all functions
2022-10-11 13:23:47 +05:30

46 lines
968 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
source $(dirname $0)/../../utils.sh
TEST_ID=$(generate_test_id)
echo "TEST_ID = $TEST_ID"
tmp_dir="/tmp/test-$TEST_ID"
mkdir -p $tmp_dir
TEST_NS=ns-$TEST_ID
export FISSION_DEFAULT_NAMESPACE=$TEST_NS
ROOT=$(dirname $0)/../../..
cleanup() {
echo "previous response" $?
log "Cleaning up..."
clean_resource_by_id_for_namespace $TEST_ID $TEST_NS
rm -rf $tmp_dir
}
if [ -z "${TEST_NOCLEANUP:-}" ]; then
trap cleanup EXIT
else
log "TEST_NOCLEANUP is set; not cleaning up test artifacts afterwards."
fi
httptrigger=http-$TEST_ID
httptriggerurl=/url-$TEST_ID
fn_n=nbuilderhello-$TEST_ID
cd $ROOT/examples/go/hello-world
kubectl create namespace $TEST_NS
log "Creating httptrigger in namespace using env var"
fission httptrigger create --function $fn_n --url /$httptriggerurl --name $httptrigger
log "verify trigger exists"
fission httptrigger list --namespace $TEST_NS | grep $httptrigger
log "Test PASSED"