Skip to content

Commit

Permalink
testsuite: cover remote PATH in ssh connector
Browse files Browse the repository at this point in the history
Problem: there is no test coverage showing that the ssh
connector sets the remote path.

Add some tests to t1106-ssh-conenctor.t.
  • Loading branch information
garlick authored and grondo committed Dec 7, 2023
1 parent f1a15de commit 4dbf614
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions t/t1106-ssh-connector.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ export TEST_SOCKDIR=$(echo $FLUX_URI | sed -e "s!local://!!") &&
export TEST_SSH=${SHARNESS_TEST_SRCDIR}/scripts/tssh
RPC=${FLUX_BUILD_DIR}/t/request/rpc

extract_env_command() {
grep cmd= \
| sed s/cmd=\"env\ // \
| sed s/\ flux\ relay.*// \
| xargs -n1
}

test_expect_success 'rundir/bin directory exists' '
test -d $(dirname $TEST_SOCKDIR)/bin
'
test_expect_success 'rundir/bin/flux symlink exists' '
test -h $(dirname $TEST_SOCKDIR)/bin/flux
'
test_expect_success 'rundir/bin/flux points to an executable' '
test -x $(dirname $TEST_SOCKDIR)/bin/flux
'
test_expect_success 'load heartbeat module with fast rate' '
flux module load heartbeat period=0.1s
'
Expand All @@ -21,6 +37,31 @@ test_expect_success 'ssh:// with local sockdir works' '
grep hostname=localhost basic.err &&
grep cmd= basic.err | grep "flux relay $TEST_SOCKDIR"
'
test_expect_success 'remote PATH is set' '
extract_env_command <basic.err >basic.env &&
grep -q "^PATH=" basic.env
'
test_expect_success 'remote PATH has rundir/bin first' '
grep -q "^PATH=$(dirname $TEST_SOCKDIR)/bin:" basic.env
'
test_expect_success 'remote PATH includes local flux bindir' '
fbindir=$(dirname $(which flux)) &&
grep -q "^PATH=.*:$fbindir" basic.env
'
test_expect_success 'remote PATH includes system bindirs' '
grep -q "^PATH=.*:/bin:/usr/bin" basic.env
'
# N.B. ensure LD_LIBRARY_PATH is set so env(1) is used when PATH is not set
# For in tree testing it is set by libtool wrappers
test_expect_success 'ssh:// with FLUX_SSH_RCMD does not set remote PATH' '
env FLUX_URI=ssh://localhost$TEST_SOCKDIR \
FLUX_SSH=$TEST_SSH \
FLUX_SSH_RCMD=flux \
LD_LIBRARY_PATH=${LD_LIBRARY_PATH=-/foo/bar} \
flux getattr size 2>basic_rcmd.err &&
extract_env_command <basic_rcmd.err >basic_rcmd.env &&
test_must_fail grep "^PATH=" basic_rcmd.env
'
test -x /bin/tcsh && test_set_prereq HAVE_TCSH
test_expect_success HAVE_TCSH 'ssh:// with local sockdir and SHELL=tcsh works' '
FLUX_URI=ssh://localhost${TEST_SOCKDIR} \
Expand Down

0 comments on commit 4dbf614

Please sign in to comment.