Skip to content

Commit bf55fac

Browse files
committed
tests: allow users to use expect/continue
1 parent 7372573 commit bf55fac

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

azure-pipelines/test.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,18 @@ if [ -z "$SKIP_NEGOTIATE_TESTS" -a -n "$GITTEST_NEGOTIATE_PASSWORD" ]; then
225225
unset GITTEST_REMOTE_URL
226226
unset GITTEST_REMOTE_DEFAULT
227227

228+
echo ""
229+
echo "Running SPNEGO tests (expect/continue)"
230+
echo ""
231+
232+
export GITTEST_REMOTE_URL="https://test.libgit2.org/kerberos/empty.git"
233+
export GITTEST_REMOTE_DEFAULT="true"
234+
export GITTEST_REMOTE_EXPECTCONTINUE="true"
235+
run_test authenticate
236+
unset GITTEST_REMOTE_URL
237+
unset GITTEST_REMOTE_DEFAULT
238+
unset GITTEST_REMOTE_EXPECTCONTINUE
239+
228240
kdestroy -A
229241
fi
230242

tests/online/clone.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ static char *_remote_proxy_host = NULL;
3030
static char *_remote_proxy_user = NULL;
3131
static char *_remote_proxy_pass = NULL;
3232
static char *_remote_proxy_selfsigned = NULL;
33+
static char *_remote_expectcontinue = NULL;
3334

3435
static int _orig_proxies_need_reset = 0;
3536
static char *_orig_http_proxy = NULL;
@@ -74,6 +75,10 @@ void test_online_clone__initialize(void)
7475
_remote_proxy_user = cl_getenv("GITTEST_REMOTE_PROXY_USER");
7576
_remote_proxy_pass = cl_getenv("GITTEST_REMOTE_PROXY_PASS");
7677
_remote_proxy_selfsigned = cl_getenv("GITTEST_REMOTE_PROXY_SELFSIGNED");
78+
_remote_expectcontinue = cl_getenv("GITTEST_REMOTE_EXPECTCONTINUE");
79+
80+
if (_remote_expectcontinue)
81+
git_libgit2_opts(GIT_OPT_ENABLE_HTTP_EXPECT_CONTINUE, 1);
7782

7883
_orig_proxies_need_reset = 0;
7984
}
@@ -99,6 +104,7 @@ void test_online_clone__cleanup(void)
99104
git__free(_remote_proxy_user);
100105
git__free(_remote_proxy_pass);
101106
git__free(_remote_proxy_selfsigned);
107+
git__free(_remote_expectcontinue);
102108

103109
if (_orig_proxies_need_reset) {
104110
cl_setenv("HTTP_PROXY", _orig_http_proxy);

tests/online/push.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ static char *_remote_ssh_pubkey = NULL;
1919
static char *_remote_ssh_passphrase = NULL;
2020

2121
static char *_remote_default = NULL;
22+
static char *_remote_expectcontinue = NULL;
2223

2324
static int cred_acquire_cb(git_cred **, const char *, const char *, unsigned int, void *);
2425

@@ -366,12 +367,16 @@ void test_online_push__initialize(void)
366367
_remote_ssh_pubkey = cl_getenv("GITTEST_REMOTE_SSH_PUBKEY");
367368
_remote_ssh_passphrase = cl_getenv("GITTEST_REMOTE_SSH_PASSPHRASE");
368369
_remote_default = cl_getenv("GITTEST_REMOTE_DEFAULT");
370+
_remote_expectcontinue = cl_getenv("GITTEST_REMOTE_EXPECTCONTINUE");
369371
_remote = NULL;
370372

371373
/* Skip the test if we're missing the remote URL */
372374
if (!_remote_url)
373375
cl_skip();
374376

377+
if (_remote_expectcontinue)
378+
git_libgit2_opts(GIT_OPT_ENABLE_HTTP_EXPECT_CONTINUE, 1);
379+
375380
cl_git_pass(git_remote_create(&_remote, _repo, "test", _remote_url));
376381

377382
record_callbacks_data_clear(&_record_cbs_data);
@@ -417,10 +422,13 @@ void test_online_push__cleanup(void)
417422
git__free(_remote_ssh_pubkey);
418423
git__free(_remote_ssh_passphrase);
419424
git__free(_remote_default);
425+
git__free(_remote_expectcontinue);
420426

421427
/* Freed by cl_git_sandbox_cleanup */
422428
_repo = NULL;
423429

430+
git_libgit2_opts(GIT_OPT_ENABLE_HTTP_EXPECT_CONTINUE, 0);
431+
424432
record_callbacks_data_clear(&_record_cbs_data);
425433

426434
cl_fixture_cleanup("testrepo.git");

0 commit comments

Comments
 (0)