Skip to content

Commit c83a879

Browse files
committed
t579*: split t5799 into several parts
Move the tests from t5799-gvfs-helper.sh into multiple scripts that can run in parallel. To ensure that the ports do not overlap, add a large multiplier on the instance when needing multiple ports within the same test (currently limited to the verb-specific cache servers). Signed-off-by: Derrick Stolee <stolee@gmail.com>
1 parent d537bcd commit c83a879

9 files changed

Lines changed: 1398 additions & 1343 deletions

t/lib-gvfs-helper.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ SERVER_LOG="$(pwd)"/OUT.server.log
6464
# Helper functions to compute port, pid-file, and log for a given
6565
# port increment. An increment of 0 (or empty) uses the base values.
6666
#
67+
# Ensure we don't overlap with any other test port by modifying a
68+
# significant bit.
6769
server_port () {
6870
local instance=${1:-0}
69-
echo $(($GIT_TEST_GVFS_PROTOCOL_PORT + $instance))
71+
echo $(($GIT_TEST_GVFS_PROTOCOL_PORT + 10000 * $instance))
7072
}
7173

7274
server_pid_file () {

t/meson.build

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,12 @@ integration_tests = [
741741
't5731-protocol-v2-bundle-uri-git.sh',
742742
't5732-protocol-v2-bundle-uri-http.sh',
743743
't5750-bundle-uri-parse.sh',
744-
't5799-gvfs-helper.sh',
744+
't5790-gvfs-helper-basic.sh',
745+
't5791-gvfs-helper-errors.sh',
746+
't5792-gvfs-helper-auth.sh',
747+
't5793-gvfs-helper-integration.sh',
748+
't5794-gvfs-helper-packfiles.sh',
749+
't5795-gvfs-helper-verb-cache.sh',
745750
't5801-remote-helpers.sh',
746751
't5802-connect-helper.sh',
747752
't5810-proto-disable-local.sh',

t/t5790-gvfs-helper-basic.sh

Lines changed: 338 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,338 @@
1+
#!/bin/sh
2+
3+
test_description='gvfs-helper basic tests'
4+
5+
. ./test-lib.sh
6+
7+
. "$TEST_DIRECTORY"/lib-gvfs-helper.sh
8+
9+
#################################################################
10+
# Basic tests to confirm the happy path works.
11+
#################################################################
12+
13+
test_expect_success 'basic: GET origin multi-get no-auth' '
14+
test_when_finished "per_test_cleanup" &&
15+
start_gvfs_protocol_server &&
16+
17+
# Connect to the origin server (w/o auth) and make a series of
18+
# single-object GET requests.
19+
#
20+
git -C "$REPO_T1" gvfs-helper \
21+
--cache-server=disable \
22+
--remote=origin \
23+
get \
24+
<"$OIDS_FILE" >OUT.output &&
25+
26+
# Stop the server to prevent the verification steps from faulting-in
27+
# any missing objects.
28+
#
29+
stop_gvfs_protocol_server &&
30+
31+
# gvfs-helper prints a "loose <oid>" message for each received object.
32+
# Verify that gvfs-helper received each of the requested objects.
33+
#
34+
sed "s/loose //" <OUT.output | sort >OUT.actual &&
35+
test_cmp "$OIDS_FILE" OUT.actual &&
36+
37+
verify_objects_in_shared_cache "$OIDS_FILE" &&
38+
verify_connection_count 1
39+
'
40+
41+
test_expect_success 'basic: GET cache-server multi-get trust-mode' '
42+
test_when_finished "per_test_cleanup" &&
43+
start_gvfs_protocol_server &&
44+
45+
# Connect to the cache-server and make a series of
46+
# single-object GET requests.
47+
#
48+
git -C "$REPO_T1" gvfs-helper \
49+
--cache-server=trust \
50+
--remote=origin \
51+
get \
52+
<"$OIDS_FILE" >OUT.output &&
53+
54+
# Stop the server to prevent the verification steps from faulting-in
55+
# any missing objects.
56+
#
57+
stop_gvfs_protocol_server &&
58+
59+
# gvfs-helper prints a "loose <oid>" message for each received object.
60+
# Verify that gvfs-helper received each of the requested objects.
61+
#
62+
sed "s/loose //" <OUT.output | sort >OUT.actual &&
63+
test_cmp "$OIDS_FILE" OUT.actual &&
64+
65+
verify_objects_in_shared_cache "$OIDS_FILE" &&
66+
verify_connection_count 1
67+
'
68+
69+
test_expect_success 'basic: GET gvfs/config' '
70+
# test_when_finished "per_test_cleanup" &&
71+
start_gvfs_protocol_server &&
72+
73+
# Connect to the cache-server and make a series of
74+
# single-object GET requests.
75+
#
76+
git -C "$REPO_T1" gvfs-helper \
77+
--cache-server=disable \
78+
--remote=origin \
79+
config \
80+
<"$OIDS_FILE" >OUT.output &&
81+
82+
# Stop the server to prevent the verification steps from faulting-in
83+
# any missing objects.
84+
#
85+
stop_gvfs_protocol_server &&
86+
87+
# The cache-server URL should be listed in the gvfs/config output.
88+
# We confirm this before assuming error-mode will work.
89+
#
90+
test_grep "$CACHE_URL" OUT.output
91+
'
92+
93+
test_expect_success 'basic: GET cache-server multi-get error-mode' '
94+
test_when_finished "per_test_cleanup" &&
95+
start_gvfs_protocol_server &&
96+
97+
# Connect to the cache-server and make a series of
98+
# single-object GET requests.
99+
#
100+
git -C "$REPO_T1" gvfs-helper \
101+
--cache-server=error \
102+
--remote=origin \
103+
get \
104+
<"$OIDS_FILE" >OUT.output &&
105+
106+
# Stop the server to prevent the verification steps from faulting-in
107+
# any missing objects.
108+
#
109+
stop_gvfs_protocol_server &&
110+
111+
# gvfs-helper prints a "loose <oid>" message for each received object.
112+
# Verify that gvfs-helper received each of the requested objects.
113+
#
114+
sed "s/loose //" <OUT.output | sort >OUT.actual &&
115+
test_cmp "$OIDS_FILE" OUT.actual &&
116+
117+
verify_objects_in_shared_cache "$OIDS_FILE" &&
118+
119+
# Technically, we have 1 connection to the origin server
120+
# for the "gvfs/config" request and 1 to cache server to
121+
# get the objects, but because we are using the same port
122+
# for both, keep-alive will handle it. So 1 connection.
123+
#
124+
verify_connection_count 1
125+
'
126+
127+
# The GVFS Protocol POST verb behaves like GET for non-commit objects
128+
# (in that it just returns the requested object), but for commit
129+
# objects POST *also* returns all trees referenced by the commit.
130+
#
131+
# The goal of this test is to confirm that gvfs-helper can send us
132+
# a packfile at all. So, this test only passes blobs to not blur
133+
# the issue.
134+
#
135+
test_expect_success 'basic: POST origin blobs' '
136+
test_when_finished "per_test_cleanup" &&
137+
start_gvfs_protocol_server &&
138+
139+
# Connect to the origin server (w/o auth) and make
140+
# multi-object POST request.
141+
#
142+
git -C "$REPO_T1" gvfs-helper \
143+
--cache-server=disable \
144+
--remote=origin \
145+
--no-progress \
146+
post \
147+
<"$OIDS_BLOBS_FILE" >OUT.output &&
148+
149+
# Stop the server to prevent the verification steps from faulting-in
150+
# any missing objects.
151+
#
152+
stop_gvfs_protocol_server &&
153+
154+
# gvfs-helper prints a "packfile <path>" message for each received
155+
# packfile. We verify the number of expected packfile(s) and we
156+
# individually verify that each requested object is present in the
157+
# shared cache (and index-pack already verified the integrity of
158+
# the packfile), so we do not bother to run "git verify-pack -v"
159+
# and do an exact matchup here.
160+
#
161+
verify_received_packfile_count 1 &&
162+
163+
verify_objects_in_shared_cache "$OIDS_BLOBS_FILE" &&
164+
verify_connection_count 1
165+
'
166+
167+
# Request a single blob via POST. Per the GVFS Protocol, the server
168+
# should implicitly send a loose object for it. Confirm that.
169+
#
170+
test_expect_success 'basic: POST-request a single blob' '
171+
test_when_finished "per_test_cleanup" &&
172+
start_gvfs_protocol_server &&
173+
174+
# Connect to the origin server (w/o auth) and request a single
175+
# blob via POST.
176+
#
177+
git -C "$REPO_T1" gvfs-helper \
178+
--cache-server=disable \
179+
--remote=origin \
180+
--no-progress \
181+
post \
182+
<"$OID_ONE_BLOB_FILE" >OUT.output &&
183+
184+
# Stop the server to prevent the verification steps from faulting-in
185+
# any missing objects.
186+
#
187+
stop_gvfs_protocol_server &&
188+
189+
# gvfs-helper prints a "loose <oid>" message for each received
190+
# loose object.
191+
#
192+
sed "s/loose //" <OUT.output | sort >OUT.actual &&
193+
test_cmp "$OID_ONE_BLOB_FILE" OUT.actual &&
194+
195+
verify_connection_count 1
196+
'
197+
198+
# Request a single commit via POST. Per the GVFS Protocol, the server
199+
# should implicitly send us a packfile containing the commit and the
200+
# trees it references. Confirm that properly handled the receipt of
201+
# the packfile. (Here, we are testing that asking for a single commit
202+
# via POST yields a packfile rather than a loose object.)
203+
#
204+
# We DO NOT verify that the packfile contains commits/trees and no blobs
205+
# because our test helper doesn't implement the filtering.
206+
#
207+
test_expect_success 'basic: POST-request a single commit' '
208+
test_when_finished "per_test_cleanup" &&
209+
start_gvfs_protocol_server &&
210+
211+
# Connect to the origin server (w/o auth) and request a single
212+
# commit via POST.
213+
#
214+
git -C "$REPO_T1" gvfs-helper \
215+
--cache-server=disable \
216+
--remote=origin \
217+
--no-progress \
218+
post \
219+
<"$OID_ONE_COMMIT_FILE" >OUT.output &&
220+
221+
# Stop the server to prevent the verification steps from faulting-in
222+
# any missing objects.
223+
#
224+
stop_gvfs_protocol_server &&
225+
226+
# gvfs-helper prints a "packfile <path>" message for each received
227+
# packfile.
228+
#
229+
verify_received_packfile_count 1 &&
230+
231+
verify_connection_count 1
232+
'
233+
234+
test_expect_success 'basic: PREFETCH w/o arg gets all' '
235+
test_when_finished "per_test_cleanup" &&
236+
start_gvfs_protocol_server &&
237+
238+
# Without a "since" argument gives us all "ct-*.pack" since the EPOCH
239+
# because we do not have any prefetch packs locally.
240+
#
241+
git -C "$REPO_T1" gvfs-helper \
242+
--cache-server=disable \
243+
--remote=origin \
244+
--no-progress \
245+
prefetch >OUT.output &&
246+
247+
# gvfs-helper prints a "packfile <path>" message for each received
248+
# packfile.
249+
#
250+
verify_received_packfile_count 3 &&
251+
verify_prefetch_keeps 1200000000 &&
252+
253+
stop_gvfs_protocol_server &&
254+
verify_connection_count 1
255+
'
256+
257+
test_expect_success 'basic: PREFETCH w/ arg' '
258+
test_when_finished "per_test_cleanup" &&
259+
start_gvfs_protocol_server &&
260+
261+
# Ask for cached packfiles NEWER THAN the given time.
262+
#
263+
git -C "$REPO_T1" gvfs-helper \
264+
--cache-server=disable \
265+
--remote=origin \
266+
--no-progress \
267+
prefetch --since="1000000000" >OUT.output &&
268+
269+
# gvfs-helper prints a "packfile <path>" message for each received
270+
# packfile.
271+
#
272+
verify_received_packfile_count 2 &&
273+
verify_prefetch_keeps 1200000000 &&
274+
275+
stop_gvfs_protocol_server &&
276+
verify_connection_count 1
277+
'
278+
279+
test_expect_success 'basic: PREFETCH mayhem no_prefetch_idx' '
280+
test_when_finished "per_test_cleanup" &&
281+
start_gvfs_protocol_server_with_mayhem no_prefetch_idx &&
282+
283+
# Request prefetch packs, but tell server to not send any
284+
# idx files and force gvfs-helper to compute them.
285+
#
286+
git -C "$REPO_T1" gvfs-helper \
287+
--cache-server=disable \
288+
--remote=origin \
289+
--no-progress \
290+
prefetch --since="1000000000" >OUT.output &&
291+
292+
# gvfs-helper prints a "packfile <path>" message for each received
293+
# packfile.
294+
#
295+
verify_received_packfile_count 2 &&
296+
verify_prefetch_keeps 1200000000 &&
297+
298+
stop_gvfs_protocol_server &&
299+
verify_connection_count 1
300+
'
301+
302+
test_expect_success 'basic: PREFETCH up-to-date' '
303+
test_when_finished "per_test_cleanup" &&
304+
start_gvfs_protocol_server &&
305+
306+
# Ask for cached packfiles NEWER THAN the given time.
307+
#
308+
git -C "$REPO_T1" gvfs-helper \
309+
--cache-server=disable \
310+
--remote=origin \
311+
--no-progress \
312+
prefetch --since="1000000000" >OUT.output &&
313+
314+
# gvfs-helper prints a "packfile <path>" message for each received
315+
# packfile.
316+
#
317+
verify_received_packfile_count 2 &&
318+
verify_prefetch_keeps 1200000000 &&
319+
320+
# Ask again for any packfiles newer than what we have cached locally.
321+
#
322+
git -C "$REPO_T1" gvfs-helper \
323+
--cache-server=disable \
324+
--remote=origin \
325+
--no-progress \
326+
prefetch >OUT.output &&
327+
328+
# gvfs-helper prints a "packfile <path>" message for each received
329+
# packfile.
330+
#
331+
verify_received_packfile_count 0 &&
332+
verify_prefetch_keeps 1200000000 &&
333+
334+
stop_gvfs_protocol_server &&
335+
verify_connection_count 2
336+
'
337+
338+
test_done

0 commit comments

Comments
 (0)