Commit 54a1bf05 by Patrick Steinhardt

tests: online::clone: inline creds-test with nonexistent URL

Right now, we test our credential callback code twice, once via SSH on
localhost and once via a non-existent GitHub repository. While the first
URL makes sense to be configurable, it does not make sense to hard-code
the non-existing repository, which requires us to call tests multiple
times. Instead, we can just inline the URL into another set of tests.
parent fea60920
...@@ -48,9 +48,6 @@ test_script: ...@@ -48,9 +48,6 @@ test_script:
# Run this early so we know it's ready by the time we need it # Run this early so we know it's ready by the time we need it
$proxyJob = Start-Job { java -jar $Env:APPVEYOR_BUILD_FOLDER\build\poxyproxy.jar -d --port 8080 --credentials foo:bar } $proxyJob = Start-Job { java -jar $Env:APPVEYOR_BUILD_FOLDER\build\poxyproxy.jar -d --port 8080 --credentials foo:bar }
ctest -V -R libgit2_clar ctest -V -R libgit2_clar
$env:GITTEST_REMOTE_URL="https://github.com/libgit2/non-existent"
$env:GITTEST_REMOTE_USER="libgit2test"
ctest -V -R libgit2_clar-cred_callback
Receive-Job -Job $proxyJob Receive-Job -Job $proxyJob
$env:GITTEST_REMOTE_PROXY_URL = "localhost:8080" $env:GITTEST_REMOTE_PROXY_URL = "localhost:8080"
$env:GITTEST_REMOTE_PROXY_USER = "foo" $env:GITTEST_REMOTE_PROXY_USER = "foo"
......
...@@ -98,15 +98,8 @@ export GITTEST_REMOTE_PROXY_PASS="bar" ...@@ -98,15 +98,8 @@ export GITTEST_REMOTE_PROXY_PASS="bar"
if [ -e ./libgit2_clar ]; then if [ -e ./libgit2_clar ]; then
./libgit2_clar -sonline::push -sonline::clone::ssh_cert && ./libgit2_clar -sonline::push -sonline::clone::ssh_cert &&
./libgit2_clar -sonline::clone::ssh_with_paths || exit $? ./libgit2_clar -sonline::clone::ssh_with_paths || exit $?
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
./libgit2_clar -sonline::clone::cred_callback || exit $?
fi
ctest -V -R libgit2_clar-proxy_credentials || exit $? ctest -V -R libgit2_clar-proxy_credentials || exit $?
fi fi
kill $(cat "$HOME/sshd/pid") kill $(cat "$HOME/sshd/pid")
export GITTEST_REMOTE_URL="https://github.com/libgit2/non-existent"
export GITTEST_REMOTE_USER="libgit2test"
ctest -V -R libgit2_clar-cred_callback
...@@ -60,5 +60,4 @@ ENDIF () ...@@ -60,5 +60,4 @@ ENDIF ()
# Add a test target which runs the cred callback tests, to be # Add a test target which runs the cred callback tests, to be
# called after setting the url and user # called after setting the url and user
ADD_TEST(libgit2_clar-cred_callback "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::cred_callback)
ADD_TEST(libgit2_clar-proxy_credentials "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::proxy_credentials_in_url -sonline::clone::proxy_credentials_request) ADD_TEST(libgit2_clar-proxy_credentials "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::proxy_credentials_in_url -sonline::clone::proxy_credentials_request)
...@@ -263,8 +263,8 @@ static int cred_failure_cb( ...@@ -263,8 +263,8 @@ static int cred_failure_cb(
void test_online_clone__cred_callback_failure_return_code_is_tunnelled(void) void test_online_clone__cred_callback_failure_return_code_is_tunnelled(void)
{ {
if (!_remote_url || !_remote_user) _remote_url = git__strdup("https://github.com/libgit2/non-existent");
clar__skip(); _remote_user = git__strdup("libgit2test");
g_options.fetch_opts.callbacks.credentials = cred_failure_cb; g_options.fetch_opts.callbacks.credentials = cred_failure_cb;
...@@ -293,8 +293,8 @@ void test_online_clone__cred_callback_called_again_on_auth_failure(void) ...@@ -293,8 +293,8 @@ void test_online_clone__cred_callback_called_again_on_auth_failure(void)
{ {
size_t counter = 0; size_t counter = 0;
if (!_remote_url || !_remote_user) _remote_url = git__strdup("https://github.com/libgit2/non-existent");
clar__skip(); _remote_user = git__strdup("libgit2test");
g_options.fetch_opts.callbacks.credentials = cred_count_calls_cb; g_options.fetch_opts.callbacks.credentials = cred_count_calls_cb;
g_options.fetch_opts.callbacks.payload = &counter; g_options.fetch_opts.callbacks.payload = &counter;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment