aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeah Rumancik <leah.rumancik@gmail.com>2023-01-23 16:18:22 -0800
committerLeah Rumancik <leah.rumancik@gmail.com>2023-01-30 13:49:36 -0800
commit220b863e1f3891b528285e9762c541451601ce11 (patch)
treed0d7fb10d078bbba4a0b3a83dae19c59bc89f21b
parent6734edc7795c571ee75e17e1ff1687de43cfb0e3 (diff)
downloadxfstests-bld-220b863e1f3891b528285e9762c541451601ce11.tar.gz
ltm: allow retry login after failed login
When LTM login fails, a cookie file is generated without any cookies. Subsequent requests to LTM do not try to login because they only check for the existence of the cookie file. To fix this, also check the cookie file has the expected cookie. Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
-rw-r--r--run-fstests/util/gce-ltm-funcs9
1 files changed, 8 insertions, 1 deletions
diff --git a/run-fstests/util/gce-ltm-funcs b/run-fstests/util/gce-ltm-funcs
index 4da3e863..b63f8441 100644
--- a/run-fstests/util/gce-ltm-funcs
+++ b/run-fstests/util/gce-ltm-funcs
@@ -32,7 +32,14 @@ function send_to_ltm() {
local cmd_to_send=$1
shift
- if test ! -f "$DIR/.ltm_cookie_$GCE_PROJECT"; then
+ # Failed login will create an empty cookie file, so ensure
+ # the file exists and contains a cookie - sometimes ltm_post_json
+ # will succeed even when login fails, so we cannot simply remove
+ # the cookie file upon ltm_post_json failure
+ if test ! -f "$DIR/.ltm_cookie_$GCE_PROJECT" || \
+ ! grep "a.$GCE_PROJECT.gce-xfstests" "$DIR/.ltm_cookie_$GCE_PROJECT" &> /dev/null
+ then
+ echo "login attempt " >> /tmp/ltm-auto-resume.debug
# just create a new login session and store it in the cookie
ltm_post_json -c $DIR/.ltm_cookie_$GCE_PROJECT -d "{\"password\":\"$GCE_LTM_PWD\"}" \
"https://$LTM_HOSTNAME/login"