Skip to content

Commit 377dcf8

Browse files
committed
REMOVE TWO FUNCTIONS:
`ct_check_exec_env_vars` and `ct_check_scl_enable_vars`. This two functions are used only in s2i-python-container Signed-off-by: Petr "Stone" Hracek <[email protected]>
1 parent 5afc367 commit 377dcf8

File tree

1 file changed

+0
-58
lines changed

1 file changed

+0
-58
lines changed

test-lib.sh

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -575,64 +575,6 @@ EOF
575575
echo "$APP_IMAGE_ID" > "$id_file"
576576
}
577577

578-
# ct_check_exec_env_vars [env_filter]
579-
# --------------------
580-
# Checks if all relevant environment variables from `docker run`
581-
# can be found in `docker exec` as well.
582-
# Argument: env_filter - optional string passed to grep used for
583-
# choosing which variables to check in the test case.
584-
# Defaults to X_SCLS and variables containing /opt/app-root, /opt/rh
585-
# Uses: $CID_FILE_DIR - path to directory containing cid_files
586-
# Uses: $IMAGE_NAME - name of the image being tested
587-
function ct_check_exec_env_vars() {
588-
local tmpdir exec_envs cid old_IFS env_filter
589-
local var_name stripped filtered_envs run_envs
590-
env_filter=${1:-"^X_SCLS=\|/opt/rh\|/opt/app-root"}
591-
tmpdir=$(mktemp -d)
592-
CID_FILE_DIR=${CID_FILE_DIR:-$(mktemp -d)}
593-
# Get environment variables from `docker run`
594-
run_envs=$(docker run --rm "$IMAGE_NAME" /bin/bash -c "env")
595-
# Get environment variables from `docker exec`
596-
ct_create_container "test_exec_envs" bash -c "sleep 1000" >/dev/null
597-
cid=$(ct_get_cid "test_exec_envs")
598-
exec_envs=$(docker exec "$cid" env)
599-
# Filter out variables we are not interested in
600-
# Always check X_SCLS, ignore PWD
601-
# Check variables from `docker run` that have alternative paths inside (/opt/rh, /opt/app-root)
602-
ct_check_envs_set "$env_filter" "$exec_envs" "$run_envs" "*VALUE*" || return 1
603-
echo " All values present in \`docker exec\`"
604-
return 0
605-
}
606-
607-
# ct_check_scl_enable_vars [env_filter]
608-
# --------------------
609-
# Checks if all relevant environment variables from `docker run`
610-
# are set twice after a second call of `scl enable $SCLS`.
611-
# Argument: env_filter - optional string passed to grep used for
612-
# choosing which variables to check in the test case.
613-
# Defaults to paths containing enabled SCLS in the image
614-
# Uses: $IMAGE_NAME - name of the image being tested
615-
function ct_check_scl_enable_vars() {
616-
local tmpdir exec_envs cid old_IFS env_filter enabled_scls
617-
local var_name stripped filtered_envs loop_envs
618-
env_filter=$1
619-
tmpdir=$(mktemp -d)
620-
enabled_scls=$(docker run --rm "$IMAGE_NAME" /bin/bash -c "echo \$X_SCLS")
621-
if [ -z "$env_filter" ]; then
622-
for scl in $enabled_scls; do
623-
[ -z "$env_filter" ] && env_filter="/$scl" && continue
624-
# env_filter not empty, append to the existing list
625-
env_filter="$env_filter|/$scl"
626-
done
627-
fi
628-
# Get environment variables from `docker run`
629-
loop_envs=$(docker run --rm "$IMAGE_NAME" /bin/bash -c "env")
630-
run_envs=$(docker run --rm "$IMAGE_NAME" /bin/bash -c "X_SCLS= scl enable $enabled_scls env")
631-
# Check if the values are set twice in the second set of envs
632-
ct_check_envs_set "$env_filter" "$run_envs" "$loop_envs" "*VALUE*VALUE*" || return 1
633-
echo " All scl_enable values present"
634-
return 0
635-
}
636578

637579
# ct_path_append PATH_VARNAME DIRECTORY
638580
# -------------------------------------

0 commit comments

Comments
 (0)