tests: online::clone: construct credential-URL from environment · pks-t/libgit2@fea6092 · GitHub
Skip to content

Commit fea6092

Browse files
committed
tests: online::clone: construct credential-URL from environment
We support two types of passing credentials to the proxy, either via the URL or explicitly by specifying user and password. We test these types by modifying the proxy URL and executing the tests twice, which is in fact unnecessary and requires us to maintain the list of environment variables and test executions across multiple CI infrastructures. To fix the situation, we can just always pass the host, port, user and password to the tests. The tests can then assemble the complete URL either with or without included credentials, allowing us to test both cases in-process.
1 parent 543ec14 commit fea6092

4 files changed

Lines changed: 21 additions & 18 deletions

File tree

‎appveyor.yml‎

Lines changed: 2 additions & 4 deletions

‎script/cibuild.sh‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ export GITTEST_REMOTE_USER=$USER
9090
export GITTEST_REMOTE_SSH_KEY="$HOME/.ssh/id_rsa"
9191
export GITTEST_REMOTE_SSH_PUBKEY="$HOME/.ssh/id_rsa.pub"
9292
export GITTEST_REMOTE_SSH_PASSPHRASE=""
93-
93+
# Use the proxy we started at the beginning
94+
export GITTEST_REMOTE_PROXY_URL="localhost:8080"
95+
export GITTEST_REMOTE_PROXY_USER="foo"
96+
export GITTEST_REMOTE_PROXY_PASS="bar"
9497

9598
if [ -e ./libgit2_clar ]; then
9699
./libgit2_clar -sonline::push -sonline::clone::ssh_cert &&
@@ -99,14 +102,7 @@ if [ -e ./libgit2_clar ]; then
99102
./libgit2_clar -sonline::clone::cred_callback || exit $?
100103
fi
101104

102-
# Use the proxy we started at the beginning
103-
export GITTEST_REMOTE_PROXY_URL="http://foo:bar@localhost:8080/"
104-
./libgit2_clar -sonline::clone::proxy_credentials_in_url || exit $?
105-
export GITTEST_REMOTE_PROXY_URL="http://localhost:8080/"
106-
export GITTEST_REMOTE_PROXY_USER="foo"
107-
export GITTEST_REMOTE_PROXY_PASS="bar"
108-
./libgit2_clar -sonline::clone::proxy_credentials_request || exit $?
109-
105+
ctest -V -R libgit2_clar-proxy_credentials || exit $?
110106
fi
111107

112108
kill $(cat "$HOME/sshd/pid")

‎tests/CMakeLists.txt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,4 @@ ENDIF ()
6161
# Add a test target which runs the cred callback tests, to be
6262
# called after setting the url and user
6363
ADD_TEST(libgit2_clar-cred_callback "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::cred_callback)
64-
ADD_TEST(libgit2_clar-proxy_credentials_in_url "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::proxy_credentials_in_url)
65-
ADD_TEST(libgit2_clar-proxy_credentials_request "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::proxy_credentials_request)
64+
ADD_TEST(libgit2_clar-proxy_credentials "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::proxy_credentials_in_url -sonline::clone::proxy_credentials_request)

‎tests/online/clone.c‎

Lines changed: 13 additions & 3 deletions

0 commit comments

Comments
 (0)