revert partial succ support (#395)

* chore: Update Dockerfile to use golang 1.22-bookworm and install additional dependencies

* revert crypto

* testcase to cover re-mapping to fail
This commit is contained in:
Boshi Lian 2024-05-30 00:18:35 -07:00 committed by GitHub
parent 865b972b07
commit 6fe67e3f5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 71 additions and 6 deletions

View file

@ -34,7 +34,7 @@ func TestFixed(t *testing.T) {
targetfie := uuid.New().String()
c, stdin, stdout, err := runCmd(
"ssh",
"ssh-9.7.1p1",
"-v",
"-o",
"StrictHostKeyChecking=no",

View file

@ -145,4 +145,58 @@ func TestKubernetes(t *testing.T) {
})
}
{
// fallback to password
t.Run("fallback to password", func(t *testing.T) {
randtext := uuid.New().String()
targetfie := uuid.New().String()
keyfiledir, err := os.MkdirTemp("", "")
if err != nil {
t.Errorf("failed to create temp key file: %v", err)
}
keyfile := path.Join(keyfiledir, "key")
if err := runCmdAndWait(
"ssh-keygen",
"-N",
"",
"-f",
keyfile,
); err != nil {
t.Errorf("failed to generate key: %v", err)
}
c, stdin, stdout, err := runCmd(
"ssh",
"-v",
"-o",
"StrictHostKeyChecking=no",
"-o",
"UserKnownHostsFile=/dev/null",
"-p",
piperport,
"-l",
"pass",
"-i",
keyfile,
piperhost,
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)
})
}
}