fix e2e not run
This commit is contained in:
parent
5e8e932d48
commit
32efae24d6
4 changed files with 21 additions and 18 deletions
|
|
@ -68,7 +68,7 @@ steps:
|
|||
- task: DockerCompose@0
|
||||
inputs:
|
||||
dockerComposeFile: '$(modulePath)/sshpiperd/e2e/docker-compose.yml'
|
||||
dockerComposeCommand: 'up --build --abort-on-container-exit --exit-code-from piper'
|
||||
dockerComposeCommand: 'up --build --abort-on-container-exit --exit-code-from client'
|
||||
currentWorkingDirectory: '$(modulePath)'
|
||||
displayName: E2E
|
||||
|
||||
|
|
|
|||
|
|
@ -16,16 +16,19 @@ services:
|
|||
- "/test.sh"
|
||||
piper:
|
||||
environment:
|
||||
- "SSHPIPERD_WORKINGDIR_NOCHECKPERM=true"
|
||||
- "SSHPIPERD_UPSTREAM_WORKINGDIR_NOCHECKPERM=true"
|
||||
- "SSHPIPERD_AUDITOR=typescript-logger"
|
||||
- "SSHPIPERD_CHALLENGER=welcometext"
|
||||
- "SSHPIPERD_CHALLENGER_WELCOMETEXT=hellopiper"
|
||||
- "SSHPIPERD_BANNERTEXT=hellopiper"
|
||||
build: ../..
|
||||
links:
|
||||
- "host1:host1"
|
||||
- "host2:host2"
|
||||
volumes:
|
||||
- workingdir:/var/sshpiper
|
||||
- ./piper.sh:/piper.sh
|
||||
command:
|
||||
- "/bin/sh"
|
||||
- "/piper.sh"
|
||||
host1:
|
||||
image: rastasheep/ubuntu-sshd
|
||||
volumes:
|
||||
|
|
@ -37,7 +40,7 @@ services:
|
|||
- names:/names
|
||||
|
||||
volumes:
|
||||
workingdir:
|
||||
workingdir:
|
||||
localkey:
|
||||
host1ssh:
|
||||
names:
|
||||
|
|
|
|||
8
sshpiperd/e2e/piper.sh
Normal file
8
sshpiperd/e2e/piper.sh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
/sshpiperd pipe add -n host1 -u host1 --upstream-username root
|
||||
/sshpiperd pipe add -n host2 -u host2 --upstream-username root
|
||||
/sshpiperd pipe list
|
||||
|
||||
|
||||
/sshpiperd daemon
|
||||
|
|
@ -1,24 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# TODO to python
|
||||
|
||||
mkdir -p /local
|
||||
mkdir -p /workingdir/host{1,2}
|
||||
|
||||
ssh-keygen -N '' -f /local/id_rsa
|
||||
ssh-keygen -N '' -f /workingdir/host1/id_rsa
|
||||
ssh-keygen -N '' -f /workingdir/host1/id_rsa #TODO pipe cmd
|
||||
|
||||
/bin/cp /local/id_rsa.pub /workingdir/host1/authorized_keys
|
||||
/bin/cp /workingdir/host1/id_rsa.pub /host1/authorized_keys
|
||||
|
||||
chmod 600 /workingdir/host1/authorized_keys
|
||||
chmod 600 /host1/authorized_keys
|
||||
|
||||
echo "root@host1" > /workingdir/host1/sshpiper_upstream
|
||||
chmod 600 /workingdir/host1/sshpiper_upstream
|
||||
|
||||
echo "root@host2" > /workingdir/host2/sshpiper_upstream
|
||||
chmod 600 /workingdir/host2/sshpiper_upstream
|
||||
|
||||
|
||||
fail="\033[0;31mFAIL\033[0m"
|
||||
succ="\033[0;32mSUCC\033[0m"
|
||||
|
||||
|
|
@ -33,6 +25,7 @@ runtest(){
|
|||
|
||||
if [ "$t" != "$rnd" ];then
|
||||
echo -e $casename $fail
|
||||
exit 1
|
||||
else
|
||||
echo -e $casename $succ
|
||||
fi
|
||||
|
|
@ -41,6 +34,7 @@ runtest(){
|
|||
|
||||
if [ $? -ne 0 ];then
|
||||
echo -e "grep typescript logger" $fail
|
||||
exit 1
|
||||
fi
|
||||
|
||||
grep "hellopiper" /tmp/$host.stderr
|
||||
|
|
@ -51,8 +45,6 @@ runtest(){
|
|||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
runtest "host1 with public key:" "host1" "ssh host1@piper -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /local/id_rsa cat /names/host1"
|
||||
runtest "host2 with password:" "host2" "sshpass -p root ssh host2@piper -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null cat /names/host2"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue