introduce first docker plugin
This commit is contained in:
parent
1d8dde5d02
commit
fdc6691d75
7 changed files with 394 additions and 0 deletions
|
|
@ -7,6 +7,10 @@ services:
|
|||
- PASSWORD_ACCESS=true
|
||||
- USER_PASSWORD=pass
|
||||
- USER_NAME=user
|
||||
labels:
|
||||
- sshpiper.username=pass
|
||||
- sshpiper.container_username=user
|
||||
- sshpiper.port=2222
|
||||
volumes:
|
||||
- shared:/shared
|
||||
- sshconfig_password:/config
|
||||
|
|
@ -32,7 +36,9 @@ services:
|
|||
- shared:/shared
|
||||
- sshconfig_publickey:/sshconfig_publickey
|
||||
- sshconfig_password:/sshconfig_password
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
command: ["./e2eentry.sh"]
|
||||
privileged: true
|
||||
working_dir: /src/e2e
|
||||
depends_on:
|
||||
- host-publickey
|
||||
|
|
|
|||
57
e2e/docker_test.go
Normal file
57
e2e/docker_test.go
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
package e2e_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func TestDocker(t *testing.T) {
|
||||
piperaddr, piperport := nextAvailablePiperAddress()
|
||||
|
||||
piper, _, _, err := runCmd("/sshpiperd/sshpiperd",
|
||||
"-p",
|
||||
piperport,
|
||||
"/sshpiperd/plugins/docker",
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("failed to run sshpiperd: %v", err)
|
||||
}
|
||||
|
||||
defer killCmd(piper)
|
||||
|
||||
waitForEndpointReady(piperaddr)
|
||||
|
||||
randtext := uuid.New().String()
|
||||
targetfie := uuid.New().String()
|
||||
|
||||
c, stdin, stdout, err := runCmd(
|
||||
"ssh",
|
||||
"-v",
|
||||
"-o",
|
||||
"StrictHostKeyChecking=no",
|
||||
"-o",
|
||||
"UserKnownHostsFile=/dev/null",
|
||||
"-p",
|
||||
piperport,
|
||||
"-l",
|
||||
"pass",
|
||||
"127.0.0.1",
|
||||
fmt.Sprintf(`sh -c "echo -n %v > /shared/%v"`, randtext, targetfie),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("failed to ssh to piper-fixed, %v", err)
|
||||
}
|
||||
|
||||
defer killCmd(c)
|
||||
|
||||
enterPassword(stdin, stdout, "pass")
|
||||
|
||||
time.Sleep(time.Second) // wait for file flush
|
||||
|
||||
checkSharedFileContent(t, targetfie, randtext)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue