From: Sebastien Buisson Date: Thu, 24 Aug 2023 09:40:46 +0000 (+0200) Subject: LU-17050 tests: test Kerberos env in sanity-krb5 X-Git-Tag: 2.15.59~170 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F68%2F52068%2F4;p=fs%2Flustre-release.git LU-17050 tests: test Kerberos env in sanity-krb5 Test Kerberos environnement is sane before trying to launch sanity-krb5 tests. Test-Parameters: trivial kerberos=true testlist=sanity-krb5 Signed-off-by: Sebastien Buisson Change-Id: I1675ba7db8c62687c69359a15cc931b5dfd40018 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52068 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Aurelien Degremont Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity-krb5.sh b/lustre/tests/sanity-krb5.sh index 94b8fab..2cfce7a 100755 --- a/lustre/tests/sanity-krb5.sh +++ b/lustre/tests/sanity-krb5.sh @@ -37,12 +37,18 @@ DBENCH_PID=0 GSS=true GSS_KRB5=true +check_krb_env() { + which klist || skip "Kerberos env not setup" + which kinit || skip "Kerberos env not setup" +} + prepare_krb5_creds() { echo prepare krb5 cred echo RUNAS=$RUNAS $RUNAS krb5_login.sh || exit 1 } +check_krb_env prepare_krb5_creds # we want double mount @@ -113,6 +119,24 @@ error_dbench() error $err_str } +# obtain and cache Kerberos ticket-granting ticket +refresh_krb5_tgt() { + local myRUNAS_UID=$1 + local myRUNAS_GID=$2 + shift 2 + local myRUNAS=$@ + if [ -z "$myRUNAS" ]; then + error_exit "myRUNAS command must be specified for refresh_krb5_tgt" + fi + + CLIENTS=${CLIENTS:-$HOSTNAME} + do_nodes $CLIENTS "set -x +if ! $myRUNAS krb5_login.sh; then + echo "Failed to refresh Krb5 TGT for UID/GID $myRUNAS_UID/$myRUNAS_GID." + exit 1 +fi" +} + restore_krb5_cred() { local keys=$(keyctl show | awk '$6 ~ "^lgssc:" {print $1}') diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 407474e..46c9d04 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -7696,24 +7696,6 @@ exit \\\${PIPESTATUS[0]}") || error_exit "failed to get the UID for $mpi_user" exit \\\${PIPESTATUS[0]}") || error_exit "failed to get the GID for $mpi_user" } -# obtain and cache Kerberos ticket-granting ticket -refresh_krb5_tgt() { - local myRUNAS_UID=$1 - local myRUNAS_GID=$2 - shift 2 - local myRUNAS=$@ - if [ -z "$myRUNAS" ]; then - error_exit "myRUNAS command must be specified for refresh_krb5_tgt" - fi - - CLIENTS=${CLIENTS:-$HOSTNAME} - do_nodes $CLIENTS "set -x -if ! $myRUNAS krb5_login.sh; then - echo "Failed to refresh Krb5 TGT for UID/GID $myRUNAS_UID/$myRUNAS_GID." - exit 1 -fi" -} - # Run multiop in the background, but wait for it to print # "PAUSING" to its stdout before returning from this function. multiop_bg_pause() {