Update docker/auth-bench/run-ab.sh

This commit is contained in:
colin 2024-02-28 14:42:12 +00:00
parent 834ea81f2d
commit 8b837c31be
1 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@
function fetch_auth_cookie { function fetch_auth_cookie {
local cms_type=${CMS_TYPE} local cms_type=${CMS_TYPE}
local cookie_file="/tmp/cookie.txt" local cookie_file="/tmp/cookie.txt" # Ensure this path matches across all functions
case $cms_type in case $cms_type in
"Concrete5") "Concrete5")
@ -12,7 +12,6 @@ function fetch_auth_cookie {
# Fetch and store the cookie for Concrete5, with verbose output for debugging # Fetch and store the cookie for Concrete5, with verbose output for debugging
curl -c "$cookie_file" -d "$login_data" -X POST "$login_url" -v > /tmp/curl_response_concrete5.txt 2>&1 curl -c "$cookie_file" -d "$login_data" -X POST "$login_url" -v > /tmp/curl_response_concrete5.txt 2>&1
# Check if the cookie was successfully fetched
if [ ! -s "$cookie_file" ]; then if [ ! -s "$cookie_file" ]; then
echo "Failed to fetch cookie for Concrete5. Check /tmp/curl_response_concrete5.txt for details." echo "Failed to fetch cookie for Concrete5. Check /tmp/curl_response_concrete5.txt for details."
exit 1 exit 1
@ -20,18 +19,19 @@ function fetch_auth_cookie {
;; ;;
"WordPress") "WordPress")
# Placeholder for WordPress authentication, to be developed
echo "WordPress authentication: To be developed" echo "WordPress authentication: To be developed"
;; ;;
*) *)
echo "Unsupported CMS type: $cms_type" echo "Unsupported CMS type: $cms_type"
exit 1
;; ;;
esac esac
} }
function prepare_log_file { function prepare_log_file {
local log_file="/logs/authenticated.csv" local log_file="/logs/authenticated.csv"
> "$log_file" > "$log_file"
@ -44,7 +44,7 @@ function run_apache_bench_and_check_ttfb {
local requests=$REQUESTS local requests=$REQUESTS
local concurrency=$CONCURRENCY local concurrency=$CONCURRENCY
local log_file="/logs/authenticated.csv" local log_file="/logs/authenticated.csv"
local cookie_file="/tmp/cookie" local cookie_file="/tmp/cookie.txt"
echo "URL,HTTP Code,Average TTFB (ms),AB Mean Time per Request (ms)" | tee "$log_file" echo "URL,HTTP Code,Average TTFB (ms),AB Mean Time per Request (ms)" | tee "$log_file"