sshpiper/e2e/connmeta_test.go
Josh Bleecher Snyder 89ab72bee0
all: run gofumpt (#652)
* all: run gofumpt

https://github.com/mvdan/gofumpt

The main appeal for me here is that my (and many other peoples')
editors run this on save, so doing a single diff here
keeps other diffs minimal.

* .github/workflows: add gofumpt checker
2025-08-29 20:04:31 -07:00

59 lines
1 KiB
Go

package e2e_test
import (
"fmt"
"testing"
"time"
"github.com/google/uuid"
)
func TestConnMeta(t *testing.T) {
piperaddr, piperport := nextAvailablePiperAddress()
piper, _, _, err := runCmd("/sshpiperd/sshpiperd",
"-p",
piperport,
"/sshpiperd/plugins/testsetmetaplugin",
"--targetaddr",
"host-password:2222",
"--",
"/sshpiperd/plugins/testgetmetaplugin",
)
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",
"user",
"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)
}