Skip to content

Commit 54a1bf0

Browse files
committed
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.
1 parent fea6092 commit 54a1bf0

File tree

4 files changed

+4
-15
lines changed

4 files changed

+4
-15
lines changed

appveyor.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ test_script:
4848
# Run this early so we know it's ready by the time we need it
4949
$proxyJob = Start-Job { java -jar $Env:APPVEYOR_BUILD_FOLDER\build\poxyproxy.jar -d --port 8080 --credentials foo:bar }
5050
ctest -V -R libgit2_clar
51-
$env:GITTEST_REMOTE_URL="https://github.com/libgit2/non-existent"
52-
$env:GITTEST_REMOTE_USER="libgit2test"
53-
ctest -V -R libgit2_clar-cred_callback
5451
Receive-Job -Job $proxyJob
5552
$env:GITTEST_REMOTE_PROXY_URL = "localhost:8080"
5653
$env:GITTEST_REMOTE_PROXY_USER = "foo"

script/cibuild.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,8 @@ export GITTEST_REMOTE_PROXY_PASS="bar"
9898
if [ -e ./libgit2_clar ]; then
9999
./libgit2_clar -sonline::push -sonline::clone::ssh_cert &&
100100
./libgit2_clar -sonline::clone::ssh_with_paths || exit $?
101-
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
102-
./libgit2_clar -sonline::clone::cred_callback || exit $?
103-
fi
104101

105102
ctest -V -R libgit2_clar-proxy_credentials || exit $?
106103
fi
107104

108105
kill $(cat "$HOME/sshd/pid")
109-
110-
export GITTEST_REMOTE_URL="https://github.com/libgit2/non-existent"
111-
export GITTEST_REMOTE_USER="libgit2test"
112-
ctest -V -R libgit2_clar-cred_callback

tests/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,4 @@ ENDIF ()
6060

6161
# Add a test target which runs the cred callback tests, to be
6262
# called after setting the url and user
63-
ADD_TEST(libgit2_clar-cred_callback "${libgit2_BINARY_DIR}/libgit2_clar" -v -sonline::clone::cred_callback)
6463
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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ static int cred_failure_cb(
263263

264264
void test_online_clone__cred_callback_failure_return_code_is_tunnelled(void)
265265
{
266-
if (!_remote_url || !_remote_user)
267-
clar__skip();
266+
_remote_url = git__strdup("https://github.com/libgit2/non-existent");
267+
_remote_user = git__strdup("libgit2test");
268268

269269
g_options.fetch_opts.callbacks.credentials = cred_failure_cb;
270270

@@ -293,8 +293,8 @@ void test_online_clone__cred_callback_called_again_on_auth_failure(void)
293293
{
294294
size_t counter = 0;
295295

296-
if (!_remote_url || !_remote_user)
297-
clar__skip();
296+
_remote_url = git__strdup("https://github.com/libgit2/non-existent");
297+
_remote_user = git__strdup("libgit2test");
298298

299299
g_options.fetch_opts.callbacks.credentials = cred_count_calls_cb;
300300
g_options.fetch_opts.callbacks.payload = &counter;

0 commit comments

Comments
 (0)