git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob 78da151f122f464360ae5105d5164b9e34817234 2206 bytes (raw)
name: t/t5556-http-auth.sh 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
 
#!/bin/sh

test_description='test http auth header and credential helper interop'

. ./test-lib.sh

test_set_port GIT_TEST_HTTP_PROTOCOL_PORT

# Setup a repository
#
REPO_DIR="$(pwd)"/repo

# Setup some lookback URLs where test-http-server will be listening.
# We will spawn it directly inside the repo directory, so we avoid
# any need to configure directory mappings etc - we only serve this
# repository from the root '/' of the server.
#
HOST_PORT=127.0.0.1:$GIT_TEST_HTTP_PROTOCOL_PORT
ORIGIN_URL=http://$HOST_PORT/

# The pid-file is created by test-http-server when it starts.
# The server will shutdown if/when we delete it (this is easier than
# killing it by PID).
#
PID_FILE="$(pwd)"/pid-file.pid
SERVER_LOG="$(pwd)"/OUT.server.log

PATH="$GIT_BUILD_DIR/t/helper/:$PATH" && export PATH

test_expect_success 'setup repos' '
	test_create_repo "$REPO_DIR" &&
	git -C "$REPO_DIR" branch -M main
'

stop_http_server () {
	if ! test -f "$PID_FILE"
	then
		return 0
	fi
	#
	# The server will shutdown automatically when we delete the pid-file.
	#
	rm -f "$PID_FILE"
	#
	# Give it a few seconds to shutdown (mainly to completely release the
	# port before the next test start another instance and it attempts to
	# bind to it).
	#
	for k in 0 1 2 3 4
	do
		if grep -q "Starting graceful shutdown" "$SERVER_LOG"
		then
			return 0
		fi
		sleep 1
	done

	echo "stop_http_server: timeout waiting for server shutdown"
	return 1
}

start_http_server () {
	#
	# Launch our server into the background in repo_dir.
	#
	(
		cd "$REPO_DIR"
		test-http-server --verbose \
			--listen=127.0.0.1 \
			--port=$GIT_TEST_HTTP_PROTOCOL_PORT \
			--reuseaddr \
			--pid-file="$PID_FILE" \
			"$@" \
			2>"$SERVER_LOG" &
	)
	#
	# Give it a few seconds to get started.
	#
	for k in 0 1 2 3 4
	do
		if test -f "$PID_FILE"
		then
			return 0
		fi
		sleep 1
	done

	echo "start_http_server: timeout waiting for server startup"
	return 1
}

per_test_cleanup () {
	stop_http_server &&
	rm -f OUT.*
}

test_expect_success 'http auth anonymous no challenge' '
	test_when_finished "per_test_cleanup" &&
	start_http_server --allow-anonymous &&

	# Attempt to read from a protected repository
	git ls-remote $ORIGIN_URL
'

test_done

debug log:

solving 78da151f122 ...
found 78da151f122 in https://public-inbox.org/git/5fb248c074acff1552874d98b28f746e1e43eac5.1667426970.git.gitgitgadget@gmail.com/ ||
	https://public-inbox.org/git/0a0f4fd10c8b29f327c35dadc7b17881f22b253a.1670880984.git.gitgitgadget@gmail.com/

applying [1/1] https://public-inbox.org/git/5fb248c074acff1552874d98b28f746e1e43eac5.1667426970.git.gitgitgadget@gmail.com/
diff --git a/t/t5556-http-auth.sh b/t/t5556-http-auth.sh
new file mode 100755
index 00000000000..78da151f122

Checking patch t/t5556-http-auth.sh...
Applied patch t/t5556-http-auth.sh cleanly.

skipping https://public-inbox.org/git/0a0f4fd10c8b29f327c35dadc7b17881f22b253a.1670880984.git.gitgitgadget@gmail.com/ for 78da151f122
index at:
100755 78da151f122f464360ae5105d5164b9e34817234	t/t5556-http-auth.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).