echo -ne $EBOLD
# default test environment variables
-TEST_ENV_VAR_FILE="../common/test_env.sh"
+TEST_ENV_VAR_FILE=""
echo "Test case started as: ${BASH_SOURCE[$i+1]} "$@
if [ -z "$1" ]; then
paramerror=1
else
- echo "Option set - Overriding test_env.sh with: "$1
+ echo "Option set - Reading test env from: "$1
shift;
foundparm=0
fi
. $TEST_ENV_VAR_FILE
else
echo -e $RED"Selected env var file does not exist: "$TEST_ENV_VAR_FILE$ERED
+ echo " Select one of following env var file matching the intended target of the test"
+ echo " Restart the test using the flag '--env-file <path-to-env-file>"
+ ls ../common/test_env* | indent1
exit 1
fi
tag="${!5}"
if [ -z $image ]; then
- echo -e $RED"\$"$4" not set in test_env"$ERED
+ echo -e $RED"\$"$4" not set in $TEST_ENV_VAR_FILE"$ERED
((IMAGE_ERR++))
echo ""
tmp=$tmp"<no-image>\t"
tmp=$tmp$image"\t"
fi
if [ -z $tag ]; then
- echo -e $RED"\$"$5" not set in test_env"$ERED
+ echo -e $RED"\$"$5" not set in $TEST_ENV_VAR_FILE"$ERED
((IMAGE_ERR++))
echo ""
tmp=$tmp"<no-tag>\t"
SIM_GROUP=$PWD/../simulator-group
if [ ! -d $SIM_GROUP ]; then
echo "Trying to set env var SIM_GROUP to dir 'simulator-group' in the nontrtric repo, but failed."
- echo -e $RED"Please set the SIM_GROUP manually in the test_env.sh"$ERED
+ echo -e $RED"Please set the SIM_GROUP manually in the applicable $TEST_ENV_VAR_FILE"$ERED
exit 1
else
echo " SIM_GROUP auto set to: " $SIM_GROUP
fi
elif [ $SIM_GROUP = *simulator_group ]; then
- echo -e $RED"Env var SIM_GROUP does not seem to point to dir 'simulator-group' in the repo, check common/test_env.sh"$ERED
+ echo -e $RED"Env var SIM_GROUP does not seem to point to dir 'simulator-group' in the repo, check $TEST_ENV_VAR_FILE"$ERED
exit 1
else
echo " SIM_GROUP env var already set to: " $SIM_GROUP
# (Function for test scripts)
set_agent_debug() {
echo -e $BOLD"Setting agent debug"$EBOLD
- curlString="$LOCALHOST$POLICY_AGENT_EXTERNAL_PORT/actuator/loggers/org.oransc.policyagent -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
+ actuator="/actuator/loggers/org.oransc.policyagent"
+ if [[ $POLICY_AGENT_IMAGE = *"onap"* ]]; then
+ actuator="/actuator/loggers/org.onap.ccsdk.oran.a1policymanagementservice"
+ fi
+ curlString="$LOCALHOST$POLICY_AGENT_EXTERNAL_PORT$actuator -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
result=$(__do_curl "$curlString")
if [ $? -ne 0 ]; then
__print_err "could not set debug mode" $@
# (Function for test scripts)
set_agent_trace() {
echo -e $BOLD"Setting agent trace"$EBOLD
- curlString="$LOCALHOST$POLICY_AGENT_EXTERNAL_PORT/actuator/loggers/org.oransc.policyagent -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
+ actuator="/actuator/loggers/org.oransc.policyagent"
+ if [[ $POLICY_AGENT_IMAGE = *"onap"* ]]; then
+ actuator="/actuator/loggers/org.onap.ccsdk.oran.a1policymanagementservice"
+ fi
+ curlString="$LOCALHOST$POLICY_AGENT_EXTERNAL_PORT$actuator -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
result=$(__do_curl "$curlString")
if [ $? -ne 0 ]; then
__print_err "could not set trace mode" $@
done
fi
+ __check_included_image 'PRODSTUB'
+ if [ $? -eq 0 ]; then
+ docker logs $PROD_STUB_APP_NAME > $TESTLOGS/$ATC/$1_prodstub.log 2>&1
+ fi
+
echo ""
}