Skip to content

Commit

Permalink
e2e: merge SSH fail and success cases
Browse files Browse the repository at this point in the history
  • Loading branch information
thockin committed Sep 20, 2023
1 parent f23784e commit b4f8ca7
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions test_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1694,7 +1694,7 @@ function e2e::auth_http_password() {
##############################################
# Test HTTP basicwith a password-file
##############################################
function e2e::auth_http_password_file_incorrect() {
function e2e::auth_http_password_file() {
# Run a git-over-HTTP server.
CTR=$(docker_run \
-v "$REPO":/git/repo:ro \
Expand Down Expand Up @@ -1731,20 +1731,20 @@ function e2e::auth_http_password_file_incorrect() {
}

##############################################
# Test SSH with bad key
# Test SSH
##############################################
function e2e::auth_ssh_wrong_key() {
function e2e::auth_ssh() {
echo "$FUNCNAME" > "$REPO/file"

# Run a git-over-SSH server. Use key #1.
# Run a git-over-SSH server. Use key #3 to exercise the multi-key logic.
CTR=$(docker_run \
-v "$DOT_SSH/server/3":/dot_ssh:ro \
-v "$REPO":/src:ro \
e2e/test/sshd)
IP=$(docker_ip "$CTR")
git -C "$REPO" commit -qam "$FUNCNAME"

# Try to sync with key #2.
# Try to sync with key #1.
GIT_SYNC \
--one-time \
--repo="test@$IP:/src" \
Expand All @@ -1754,26 +1754,9 @@ function e2e::auth_ssh_wrong_key() {
--ssh-known-hosts=false \
--ssh-key-file="/ssh/secret.2" \
|| true

# check for failure
assert_file_absent "$ROOT/link/file"
}

##############################################
# Test SSH
##############################################
function e2e::auth_ssh() {
# Run a git-over-SSH server. Use key #3 to exercise the multi-key logic.
CTR=$(docker_run \
-v "$DOT_SSH/server/3":/dot_ssh:ro \
-v "$REPO":/git/repo:ro \
e2e/test/sshd)
IP=$(docker_ip "$CTR")

# Configure the repo.
echo "$FUNCNAME" > "$REPO/file"
git -C "$REPO" commit -qam "$FUNCNAME"

# Try to sync with multiple keys
GIT_SYNC \
--one-time \
--repo="test@$IP:/git/repo" \
Expand Down

0 comments on commit b4f8ca7

Please sign in to comment.