Fix askpass tests
This commit is contained in:
parent
0e422616a4
commit
ece56840f8
|
|
@ -18,11 +18,11 @@ fi
|
|||
# Askpass git only support repo started with "file://" which is used in test_e2e.sh.
|
||||
REPO=$(echo "$@" | grep -o "file://[^ ]*")
|
||||
OUTPUT=$(echo "url=${REPO}" | git credential fill)
|
||||
USERNAME=$(echo ${OUTPUT} | grep -o "username=.*")
|
||||
PASSWD=$(echo ${OUTPUT} | grep -o "password=.*")
|
||||
USERNAME=$(echo "${OUTPUT}" | grep "^username=.*")
|
||||
PASSWD=$(echo "${OUTPUT}" | grep "^password=.*")
|
||||
# Test case must match the magic username and password below.
|
||||
if [ "${PASSWD}" != "password=Lov3!k0os" || "${USERNAME}" != "gitsync@example.com" ]; then
|
||||
echo "invalid username/password pair: ${USERNAME}:${PASSWD}, try gitsync@example.com:Lov3!k0os next time."
|
||||
if [ "${USERNAME}" != "username=my-username" -o "${PASSWD}" != "password=my-password" ]; then
|
||||
echo "invalid test username/password pair: ${USERNAME}:${PASSWD}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
24
test_e2e.sh
24
test_e2e.sh
|
|
@ -641,8 +641,8 @@ git -C "$REPO" commit -qam "$TESTCASE 1"
|
|||
# run with askpass_git but with wrong password
|
||||
GIT_SYNC \
|
||||
--git=$ASKPASS_GIT \
|
||||
--username="gitsync@example.com" \
|
||||
--password="I have no idea what the password is." \
|
||||
--username="my-username" \
|
||||
--password="wrong" \
|
||||
--logtostderr \
|
||||
--v=5 \
|
||||
--one-time \
|
||||
|
|
@ -657,8 +657,8 @@ assert_file_absent "$ROOT"/link/file
|
|||
# run with askpass_git with correct password
|
||||
GIT_SYNC \
|
||||
--git=$ASKPASS_GIT \
|
||||
--username="gitsync@example.com" \
|
||||
--password="Lov3!k0os" \
|
||||
--username="my-username" \
|
||||
--password="my-password" \
|
||||
--logtostderr \
|
||||
--v=5 \
|
||||
--one-time \
|
||||
|
|
@ -682,7 +682,13 @@ echo "$TESTCASE 1" > "$REPO"/file
|
|||
freencport
|
||||
git -C "$REPO" commit -qam "$TESTCASE 1"
|
||||
# run the askpass_url service with wrong password
|
||||
{ (for i in 1 2; do echo -e 'HTTP/1.1 200 OK\r\n\r\nusername=you@example.com\npassword=dummypw' | nc -N -l $NCPORT > /dev/null; done) &}
|
||||
{ (
|
||||
for i in 1 2; do
|
||||
echo -e 'HTTP/1.1 200 OK\r\n\r\nusername=my-username\npassword=wrong' \
|
||||
| nc -N -l $NCPORT > /dev/null;
|
||||
done
|
||||
) &
|
||||
}
|
||||
GIT_SYNC \
|
||||
--git=$ASKPASS_GIT \
|
||||
--askpass-url="http://localhost:$NCPORT/git_askpass" \
|
||||
|
|
@ -698,7 +704,13 @@ GIT_SYNC \
|
|||
# check for failure
|
||||
assert_file_absent "$ROOT"/link/file
|
||||
# run with askpass_url service with correct password
|
||||
{ (for i in 1 2; do echo -e 'HTTP/1.1 200 OK\r\n\r\nusername=you@example.com\npassword=Lov3!k0os' | nc -N -l $NCPORT > /dev/null; done) &}
|
||||
{ (
|
||||
for i in 1 2; do
|
||||
echo -e 'HTTP/1.1 200 OK\r\n\r\nusername=my-username\npassword=my-password' \
|
||||
| nc -N -l $NCPORT > /dev/null;
|
||||
done
|
||||
) &
|
||||
}
|
||||
GIT_SYNC \
|
||||
--git=$ASKPASS_GIT \
|
||||
--askpass-url="http://localhost:$NCPORT/git_askpass" \
|
||||
|
|
|
|||
Loading…
Reference in New Issue