Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add e2e for password-file #816

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion test_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ function e2e::sync_depth_change_on_restart() {
}

##############################################
# Test HTTP with password
# Test HTTP basicauth with a password
##############################################
function e2e::auth_http_password() {
# Run a git-over-HTTP server.
Expand Down Expand Up @@ -1691,6 +1691,48 @@ function e2e::auth_http_password() {
assert_file_eq "$ROOT/link/file" "$FUNCNAME"
}

##############################################
# Test HTTP basicauth with a password-file
##############################################
function e2e::auth_http_password_file() {
echo "$FUNCNAME" > "$REPO/file"
git -C "$REPO" commit -qam "$FUNCNAME"

# Run a git-over-HTTP server.
CTR=$(docker_run \
-v "$REPO":/git/repo:ro \
e2e/test/httpd)
IP=$(docker_ip "$CTR")

# Make a password file with a bad password.
echo -n "wrong" > "$WORK/password-file"

GIT_SYNC \
--one-time \
--repo="http://$IP/repo" \
--root="$ROOT" \
--link="link" \
--username="testuser" \
--password-file="$WORK/password-file" \
|| true
assert_file_absent "$ROOT/link/file"

# Make a password file the right password.
echo -n "testpass" > "$WORK/password-file"

GIT_SYNC \
--one-time \
--repo="http://$IP/repo" \
--root="$ROOT" \
--link="link" \
--username="testuser" \
--password-file="$WORK/password-file"

assert_link_exists "$ROOT/link"
assert_file_exists "$ROOT/link/file"
assert_file_eq "$ROOT/link/file" "$FUNCNAME"
}

##############################################
# Test SSH with bad key
##############################################
Expand Down
Loading