#!/bin/sh -e mkdir -p ~/.ssh cp /integration/client_test_rsa ~/.ssh/id_rsa chmod -R 700 ~/.ssh cat >~/.ssh/config < backup-1 ssh sshportal -l admin config restore --confirm < backup-1 ssh sshportal -l admin config backup --indent --ignore-events > backup-2 ( cat backup-1 | grep -v '"date":' | grep -v 'tedAt":' > backup-1.clean cat backup-2 | grep -v '"date":' | grep -v 'tedAt":' > backup-2.clean set -xe diff backup-1.clean backup-2.clean ) # bastion ssh sshportal -l admin host create --name=testserver toto@testserver:2222 out="$(ssh sshportal -l testserver echo hello | head -n 1)" test "$out" = '{"User":"toto","Environ":null,"Command":["echo","hello"]}' out="$(TEST_A=1 TEST_B=2 TEST_C=3 TEST_D=4 TEST_E=5 TEST_F=6 TEST_G=7 TEST_H=8 TEST_I=9 ssh sshportal -l testserver echo hello | head -n 1)" test "$out" = '{"User":"toto","Environ":["TEST_A=1","TEST_B=2","TEST_C=3","TEST_D=4","TEST_E=5","TEST_F=6","TEST_G=7","TEST_H=8","TEST_I=9"],"Command":["echo","hello"]}' # TODO: test more cases (forwards, scp, sftp, interactive, pty, stdin, exit code, ...)