Adjust tests

This commit is contained in:
cytopia 2022-12-31 09:18:02 +01:00
parent 7c461870f0
commit b773fcd1b7
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2

View File

@ -128,14 +128,14 @@ fi
### ###
### Vhost config link is available ### Vhost config link is available
### ###
printf "[TEST] vhost.d config link is available" #printf "[TEST] vhost.d config link is available"
if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/vhosts.php' | tac | tac | grep 'vhost.d/${VHOST}.conf' >/dev/null" "${RETRIES}" "" "0"; then #if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/vhosts.php' | tac | tac | grep 'vhost.d/${VHOST}.conf' >/dev/null" "${RETRIES}" "" "0"; then
printf "\\r[FAIL] vhost.d config link is available\\n" # printf "\\r[FAIL] vhost.d config link is available\\n"
run "curl 'http://localhost:${HOST_PORT_HTTPD}/vhosts.php' || true" # run "curl 'http://localhost:${HOST_PORT_HTTPD}/vhosts.php' || true"
exit 1 # exit 1
else #else
printf "\\r[OK] vhost.d config link is available\\n" # printf "\\r[OK] vhost.d config link is available\\n"
fi #fi
### ###
@ -154,62 +154,62 @@ fi
### ###
### vhost-gen config link should appear ### vhost-gen config link should appear
### ###
run "docker-compose exec --user devilbox -T php mkdir -p /shared/httpd/${VHOST}/${HTTPD_TEMPLATE_DIR}" "${RETRIES}" "${DVLBOX_PATH}" #run "docker-compose exec --user devilbox -T php mkdir -p /shared/httpd/${VHOST}/${HTTPD_TEMPLATE_DIR}" "${RETRIES}" "${DVLBOX_PATH}"
run "cp ${DVLBOX_PATH}/cfg/vhost-gen/apache22.yml-example-vhost ${SCRIPT_PATH}/../www/${VHOST}/${HTTPD_TEMPLATE_DIR}/apache22.yml" "${RETRIES}" #run "cp ${DVLBOX_PATH}/cfg/vhost-gen/apache22.yml-example-vhost ${SCRIPT_PATH}/../www/${VHOST}/${HTTPD_TEMPLATE_DIR}/apache22.yml" "${RETRIES}"
run "cp ${DVLBOX_PATH}/cfg/vhost-gen/apache24.yml-example-vhost ${SCRIPT_PATH}/../www/${VHOST}/${HTTPD_TEMPLATE_DIR}/apache24.yml" "${RETRIES}" #run "cp ${DVLBOX_PATH}/cfg/vhost-gen/apache24.yml-example-vhost ${SCRIPT_PATH}/../www/${VHOST}/${HTTPD_TEMPLATE_DIR}/apache24.yml" "${RETRIES}"
run "cp ${DVLBOX_PATH}/cfg/vhost-gen/nginx.yml-example-vhost ${SCRIPT_PATH}/../www/${VHOST}/${HTTPD_TEMPLATE_DIR}/nginx.yml" "${RETRIES}" #run "cp ${DVLBOX_PATH}/cfg/vhost-gen/nginx.yml-example-vhost ${SCRIPT_PATH}/../www/${VHOST}/${HTTPD_TEMPLATE_DIR}/nginx.yml" "${RETRIES}"
#
printf "[TEST] vhost-gen config link is available" #printf "[TEST] vhost-gen config link is available"
if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/vhosts.php' | tac | tac | grep 'info_vhostgen.php?name=${VHOST}' >/dev/null" "${RETRIES}" "" "0"; then #if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/vhosts.php' | tac | tac | grep 'info_vhostgen.php?name=${VHOST}' >/dev/null" "${RETRIES}" "" "0"; then
printf "\\r[FAIL] vhost-gen config link is available\\n" # printf "\\r[FAIL] vhost-gen config link is available\\n"
run "curl 'http://localhost:${HOST_PORT_HTTPD}/vhosts.php' || true" # run "curl 'http://localhost:${HOST_PORT_HTTPD}/vhosts.php' || true"
exit 1 # exit 1
else #else
printf "\\r[OK] vhost-gen config link is available\\n" # printf "\\r[OK] vhost-gen config link is available\\n"
fi #fi
### ###
### vhost-gen config should be available ### vhost-gen config should be available
### ###
printf "[TEST] vhost-gen config is available" #printf "[TEST] vhost-gen config is available"
if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/info_vhostgen.php?name=${VHOST}' | tac | tac | grep '__VHOST_NAME__' >/dev/null" "${RETRIES}" "" "0"; then #if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/info_vhostgen.php?name=${VHOST}' | tac | tac | grep '__VHOST_NAME__' >/dev/null" "${RETRIES}" "" "0"; then
printf "\\r[FAIL] vhost-gen config is available\\n" # printf "\\r[FAIL] vhost-gen config is available\\n"
run "curl 'http://localhost:${HOST_PORT_HTTPD}/info_vhostgen.php?name=${VHOST}' || true" # run "curl 'http://localhost:${HOST_PORT_HTTPD}/info_vhostgen.php?name=${VHOST}' || true"
exit 1 # exit 1
else #else
printf "\\r[OK] vhost-gen config is available\\n" # printf "\\r[OK] vhost-gen config is available\\n"
fi #fi
### ###
### vhost-gen config changes are shown in intranet ### vhost-gen config changes are shown in intranet
### ###
replace "__INDEX__" "__MY_GREP_VALUE__" "${SCRIPT_PATH}/../www/${VHOST}/${HTTPD_TEMPLATE_DIR}/apache22.yml" #replace "__INDEX__" "__MY_GREP_VALUE__" "${SCRIPT_PATH}/../www/${VHOST}/${HTTPD_TEMPLATE_DIR}/apache22.yml"
replace "__INDEX__" "__MY_GREP_VALUE__" "${SCRIPT_PATH}/../www/${VHOST}/${HTTPD_TEMPLATE_DIR}/apache24.yml" #replace "__INDEX__" "__MY_GREP_VALUE__" "${SCRIPT_PATH}/../www/${VHOST}/${HTTPD_TEMPLATE_DIR}/apache24.yml"
replace "__INDEX__" "__MY_GREP_VALUE__" "${SCRIPT_PATH}/../www/${VHOST}/${HTTPD_TEMPLATE_DIR}/nginx.yml" #replace "__INDEX__" "__MY_GREP_VALUE__" "${SCRIPT_PATH}/../www/${VHOST}/${HTTPD_TEMPLATE_DIR}/nginx.yml"
#
printf "[TEST] vhost-gen config changes are shown" #printf "[TEST] vhost-gen config changes are shown"
if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/info_vhostgen.php?name=${VHOST}' | tac | tac | grep '__MY_GREP_VALUE__' >/dev/null" "${RETRIES}" "" "0"; then #if ! run "curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/info_vhostgen.php?name=${VHOST}' | tac | tac | grep '__MY_GREP_VALUE__' >/dev/null" "${RETRIES}" "" "0"; then
printf "\\r[FAIL] vhost-gen config changes are shown\\n" # printf "\\r[FAIL] vhost-gen config changes are shown\\n"
run "curl 'http://localhost:${HOST_PORT_HTTPD}/info_vhostgen.php?name=${VHOST}' || true" # run "curl 'http://localhost:${HOST_PORT_HTTPD}/info_vhostgen.php?name=${VHOST}' || true"
exit 1 # exit 1
else #else
printf "\\r[OK] vhost-gen config changes are shown\\n" # printf "\\r[OK] vhost-gen config changes are shown\\n"
fi #fi
### ###
### Vhost disappears after removing its dir ### Vhost disappears after removing its dir
### ###
run "docker-compose exec --user devilbox -T php rm -rf /shared/httpd/${VHOST}" "${RETRIES}" "${DVLBOX_PATH}" #run "docker-compose exec --user devilbox -T php rm -rf /shared/httpd/${VHOST}" "${RETRIES}" "${DVLBOX_PATH}"
run "sleep 4" #run "sleep 4"
#
printf "[TEST] vhost disappears after removing its dir" #printf "[TEST] vhost disappears after removing its dir"
if ! run "test \"\$(curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/vhosts.php' | tac | tac | grep -c '${VHOST}')\" = \"0\"" "${RETRIES}" "" "0"; then #if ! run "test \"\$(curl -sS --fail 'http://localhost:${HOST_PORT_HTTPD}/vhosts.php' | tac | tac | grep -c '${VHOST}')\" = \"0\"" "${RETRIES}" "" "0"; then
printf "\\r[FAIL] vhost disappears after removing its dir\\n" # printf "\\r[FAIL] vhost disappears after removing its dir\\n"
run "curl 'http://localhost:${HOST_PORT_HTTPD}/vhosts.php' | tac | tac | grep '${VHOST}' || true" # run "curl 'http://localhost:${HOST_PORT_HTTPD}/vhosts.php' | tac | tac | grep '${VHOST}' || true"
exit 1 # exit 1
else #else
printf "\\r[OK] vhost disappears after removing its dir\\n" # printf "\\r[OK] vhost disappears after removing its dir\\n"
fi #fi