Skip to content

Commit

Permalink
fix ping@openssh being passed to unsupported sshd (#326)
Browse files Browse the repository at this point in the history
* add testcase

* Fix formatting in e2e/fixed_test.go

* disable ping until we have a solution
  • Loading branch information
tg123 committed Feb 15, 2024
1 parent 715bcbd commit fb8eba9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/golang:1.22-bullseye as builder
FROM docker.io/golang:1.22.0-alpine3.19 as builder

ARG VER=devel
ARG BUILDTAGS=""
Expand All @@ -12,6 +12,9 @@ RUN --mount=target=/src,type=bind,source=. --mount=type=cache,target=/root/.cach
RUN --mount=target=/src,type=bind,source=. --mount=type=cache,target=/root/.cache/go-build if [ "$EXTERNAL" = "1" ]; then cp -r plugins /sshpiperd ; else go build -o /sshpiperd/plugins -tags "$BUILDTAGS" ./plugin/...; fi
ADD entrypoint.sh /sshpiperd

FROM builder as testrunner
RUN apk add openssh-client git bash coreutils

FROM docker.io/busybox
LABEL maintainer="Boshi Lian<[email protected]>"

Expand Down
2 changes: 1 addition & 1 deletion crypto
2 changes: 1 addition & 1 deletion e2e/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ services:
- DOCKER_API_VERSION=1.40
build:
context: ../
target: builder
target: testrunner
args:
- BUILDTAGS=e2e
volumes:
Expand Down
10 changes: 8 additions & 2 deletions e2e/fixed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ func TestFixed(t *testing.T) {
"StrictHostKeyChecking=no",
"-o",
"UserKnownHostsFile=/dev/null",
"-o",
"RequestTTY=yes",
"-p",
piperport,
"-l",
"user",
"127.0.0.1",
fmt.Sprintf(`sh -c "echo -n %v > /shared/%v"`, randtext, targetfie),
fmt.Sprintf(`sh -c "echo SSHREADY && sleep 1 && echo -n %v > /shared/%v"`, randtext, targetfie), // sleep 1 to cover https://github.com/tg123/sshpiper/issues/323
)

if err != nil {
Expand All @@ -56,7 +58,11 @@ func TestFixed(t *testing.T) {

enterPassword(stdin, stdout, "pass")

time.Sleep(time.Second) // wait for file flush
waitForStdoutContains(stdout, "SSHREADY", func(_ string) {
_, _ = stdin.Write([]byte(fmt.Sprintf("%v\n", "triggerping")))
})

time.Sleep(time.Second * 3) // wait for file flush

checkSharedFileContent(t, targetfie, randtext)
}
Expand Down

0 comments on commit fb8eba9

Please sign in to comment.