These tests depends on not yet released version on TGTD to allow running both TGTD and TGTADM as unprivileged users to set up and configure targets to test against during make test. Update TGTD to tip of master before running these tests. See STGT mailinglist for patches. Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
73 lines
2.1 KiB
Bash
Executable File
73 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
. ./functions.sh
|
|
|
|
echo "CHAP tests"
|
|
|
|
start_target
|
|
create_lun
|
|
setup_chap
|
|
|
|
echo -n "Test logging in without credentials (should fail) ... "
|
|
../utils/iscsi-inq -i ${IQNINITIATOR} iscsi://${TGTPORTAL}/${IQNTARGET}/1 > /dev/null && failure
|
|
success
|
|
|
|
|
|
echo -n "Test logging in with invalid user (should fail) ... "
|
|
LIBISCSI_CHAP_USERNAME=wrong \
|
|
LIBISCSI_CHAP_PASSWORD=libiscsi \
|
|
../utils/iscsi-inq -i ${IQNINITIATOR} iscsi://127.0.0.1:3260/${IQNTARGET}/1 > /dev/null && failure
|
|
success
|
|
|
|
|
|
echo -n "Test logging in with wrong password (should fail) ... "
|
|
LIBISCSI_CHAP_USERNAME=libiscsi \
|
|
LIBISCSI_CHAP_PASSWORD=wrong \
|
|
../utils/iscsi-inq -i ${IQNINITIATOR} iscsi://127.0.0.1:3260/${IQNTARGET}/1 > /dev/null && failure
|
|
success
|
|
|
|
|
|
echo -n "Test logging in with correct credentials (ENV) ... "
|
|
LIBISCSI_CHAP_USERNAME=libiscsi \
|
|
LIBISCSI_CHAP_PASSWORD=libiscsi \
|
|
../utils/iscsi-inq -i ${IQNINITIATOR} iscsi://127.0.0.1:3260/${IQNTARGET}/1 > /dev/null || failure
|
|
success
|
|
|
|
|
|
echo -n "Test logging in with correct credentials (URL) ... "
|
|
../utils/iscsi-inq -i ${IQNINITIATOR} iscsi://libiscsi%libiscsi@127.0.0.1:3260/${IQNTARGET}/1 > /dev/null || failure
|
|
success
|
|
|
|
|
|
echo -n "Test bidir-chap with incorrect user (should fail) ... "
|
|
LIBISCSI_CHAP_USERNAME=libiscsi \
|
|
LIBISCSI_CHAP_PASSWORD=libiscsi \
|
|
LIBISCSI_CHAP_TARGET_USERNAME=wrong \
|
|
LIBISCSI_CHAP_TARGET_PASSWORD=outgoing \
|
|
../utils/iscsi-inq -i ${IQNINITIATOR} iscsi://127.0.0.1:3260/${IQNTARGET}/1 > /dev/null && failure
|
|
success
|
|
|
|
|
|
echo -n "Test bidir-chap with incorrect password (should fail) ... "
|
|
LIBISCSI_CHAP_USERNAME=libiscsi \
|
|
LIBISCSI_CHAP_PASSWORD=libiscsi \
|
|
LIBISCSI_CHAP_TARGET_USERNAME=outgoing \
|
|
LIBISCSI_CHAP_TARGET_PASSWORD=wrong \
|
|
../utils/iscsi-inq -i ${IQNINITIATOR} iscsi://127.0.0.1:3260/${IQNTARGET}/1 > /dev/null && failure
|
|
success
|
|
|
|
|
|
echo -n "Test bidir-chap with correct credentials we get from... "
|
|
LIBISCSI_CHAP_USERNAME=libiscsi \
|
|
LIBISCSI_CHAP_PASSWORD=libiscsi \
|
|
LIBISCSI_CHAP_TARGET_USERNAME=outgoing \
|
|
LIBISCSI_CHAP_TARGET_PASSWORD=outgoing \
|
|
../utils/iscsi-inq -i ${IQNINITIATOR} iscsi://127.0.0.1:3260/${IQNTARGET}/1 > /dev/null || failure
|
|
success
|
|
|
|
|
|
shutdown_target
|
|
delete_lun
|
|
|
|
exit 0
|