Skip to content

Commit 7fd9b3f

Browse files
committed
ci: add NTLM tests
Download poxygit, a debugging git server, and clone from it using NTLM, both IIS-style (with connection affinity) and Apache-style ("broken", requiring constant reauthentication).
1 parent 29762e4 commit 7fd9b3f

File tree

2 files changed

+51
-9
lines changed

2 files changed

+51
-9
lines changed

azure-pipelines/test.sh

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ if [ -n "$SKIP_TESTS" ]; then
66
exit 0
77
fi
88

9+
# Windows doesn't run the NTLM tests properly (yet)
10+
if [[ "$(uname -s)" == MINGW* ]]; then
11+
SKIP_NTLM_TESTS=1
12+
fi
13+
914
SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )}
1015
BUILD_DIR=$(pwd)
1116
TMPDIR=${TMPDIR:-/tmp}
@@ -89,6 +94,16 @@ if [ -z "$SKIP_PROXY_TESTS" ]; then
8994
java -jar poxyproxy.jar --address 127.0.0.1 --port 8090 --credentials foo:bar --auth-type ntlm --quiet &
9095
fi
9196

97+
if [ -z "$SKIP_NTLM_TESTS" ]; then
98+
curl -L https://github.com/ethomson/poxygit/releases/download/v0.4.0/poxygit-0.4.0.jar >poxygit.jar
99+
100+
echo ""
101+
echo "Starting HTTP server..."
102+
NTLM_DIR=`mktemp -d ${TMPDIR}/ntlm.XXXXXXXX`
103+
git init --bare "${NTLM_DIR}/test.git"
104+
java -jar poxygit.jar --address 127.0.0.1 --port 9000 --credentials foo:baz --quiet "${NTLM_DIR}" &
105+
fi
106+
92107
if [ -z "$SKIP_SSH_TESTS" ]; then
93108
echo "Starting ssh daemon..."
94109
HOME=`mktemp -d ${TMPDIR}/home.XXXXXXXX`
@@ -207,6 +222,32 @@ if [ -z "$SKIP_PROXY_TESTS" ]; then
207222
unset GITTEST_REMOTE_PROXY_PASS
208223
fi
209224

225+
if [ -z "$SKIP_NTLM_TESTS" ]; then
226+
echo ""
227+
echo "Running NTLM tests (IIS emulation)"
228+
echo ""
229+
230+
export GITTEST_REMOTE_URL="http://localhost:9000/ntlm/test.git"
231+
export GITTEST_REMOTE_USER="foo"
232+
export GITTEST_REMOTE_PASS="baz"
233+
run_test auth_clone_and_push
234+
unset GITTEST_REMOTE_URL
235+
unset GITTEST_REMOTE_USER
236+
unset GITTEST_REMOTE_PASS
237+
238+
echo ""
239+
echo "Running NTLM tests (Apache emulation)"
240+
echo ""
241+
242+
export GITTEST_REMOTE_URL="http://localhost:9000/broken-ntlm/test.git"
243+
export GITTEST_REMOTE_USER="foo"
244+
export GITTEST_REMOTE_PASS="baz"
245+
run_test auth_clone_and_push
246+
unset GITTEST_REMOTE_URL
247+
unset GITTEST_REMOTE_USER
248+
unset GITTEST_REMOTE_PASS
249+
fi
250+
210251
if [ -z "$SKIP_NEGOTIATE_TESTS" -a -n "$GITTEST_NEGOTIATE_PASSWORD" ]; then
211252
echo ""
212253
echo "Running SPNEGO tests"
@@ -221,7 +262,7 @@ if [ -z "$SKIP_NEGOTIATE_TESTS" -a -n "$GITTEST_NEGOTIATE_PASSWORD" ]; then
221262

222263
export GITTEST_REMOTE_URL="https://test.libgit2.org/kerberos/empty.git"
223264
export GITTEST_REMOTE_DEFAULT="true"
224-
run_test authenticate
265+
run_test auth_clone
225266
unset GITTEST_REMOTE_URL
226267
unset GITTEST_REMOTE_DEFAULT
227268

@@ -232,7 +273,7 @@ if [ -z "$SKIP_NEGOTIATE_TESTS" -a -n "$GITTEST_NEGOTIATE_PASSWORD" ]; then
232273
export GITTEST_REMOTE_URL="https://test.libgit2.org/kerberos/empty.git"
233274
export GITTEST_REMOTE_DEFAULT="true"
234275
export GITTEST_REMOTE_EXPECTCONTINUE="true"
235-
run_test authenticate
276+
run_test auth_clone
236277
unset GITTEST_REMOTE_URL
237278
unset GITTEST_REMOTE_DEFAULT
238279
unset GITTEST_REMOTE_EXPECTCONTINUE

tests/CMakeLists.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ FUNCTION(ADD_CLAR_TEST name)
6060
ENDIF()
6161
ENDFUNCTION(ADD_CLAR_TEST)
6262

63-
ADD_CLAR_TEST(offline -v -xonline)
64-
ADD_CLAR_TEST(invasive -v -score::ftruncate -sfilter::stream::bigfile -sodb::largefiles -siterator::workdir::filesystem_gunk -srepo::init -srepo::init::at_filesystem_root)
65-
ADD_CLAR_TEST(online -v -sonline)
66-
ADD_CLAR_TEST(gitdaemon -v -sonline::push)
67-
ADD_CLAR_TEST(ssh -v -sonline::push -sonline::clone::ssh_cert -sonline::clone::ssh_with_paths -sonline::clone::path_whitespace_ssh)
68-
ADD_CLAR_TEST(proxy -v -sonline::clone::proxy)
69-
ADD_CLAR_TEST(authenticate -v -sonline::clone::credentials)
63+
ADD_CLAR_TEST(offline -v -xonline)
64+
ADD_CLAR_TEST(invasive -v -score::ftruncate -sfilter::stream::bigfile -sodb::largefiles -siterator::workdir::filesystem_gunk -srepo::init -srepo::init::at_filesystem_root)
65+
ADD_CLAR_TEST(online -v -sonline)
66+
ADD_CLAR_TEST(gitdaemon -v -sonline::push)
67+
ADD_CLAR_TEST(ssh -v -sonline::push -sonline::clone::ssh_cert -sonline::clone::ssh_with_paths -sonline::clone::path_whitespace_ssh)
68+
ADD_CLAR_TEST(proxy -v -sonline::clone::proxy)
69+
ADD_CLAR_TEST(auth_clone -v -sonline::clone::cred)
70+
ADD_CLAR_TEST(auth_clone_and_push -v -sonline::clone::push -sonline::push)

0 commit comments

Comments
 (0)