Show More
@@ -1,151 +1,334 b'' | |||||
1 | #require serve no-reposimplestore |
|
1 | #require serve no-reposimplestore | |
2 |
|
2 | |||
3 | $ cat >> $HGRCPATH <<EOF |
|
3 | $ cat >> $HGRCPATH <<EOF | |
4 | > [extensions] |
|
4 | > [extensions] | |
5 | > lfs= |
|
5 | > lfs= | |
6 | > [lfs] |
|
6 | > [lfs] | |
7 | > url=http://localhost:$HGPORT/.git/info/lfs |
|
|||
8 | > track=all() |
|
7 | > track=all() | |
9 | > [web] |
|
8 | > [web] | |
10 | > push_ssl = False |
|
9 | > push_ssl = False | |
11 | > allow-push = * |
|
10 | > allow-push = * | |
12 | > EOF |
|
11 | > EOF | |
13 |
|
12 | |||
14 | Serving LFS files can experimentally be turned off. The long term solution is |
|
13 | Serving LFS files can experimentally be turned off. The long term solution is | |
15 | to support the 'verify' action in both client and server, so that the server can |
|
14 | to support the 'verify' action in both client and server, so that the server can | |
16 | tell the client to store files elsewhere. |
|
15 | tell the client to store files elsewhere. | |
17 |
|
16 | |||
18 | $ hg init server |
|
17 | $ hg init server | |
19 | $ hg --config "lfs.usercache=$TESTTMP/servercache" \ |
|
18 | $ hg --config "lfs.usercache=$TESTTMP/servercache" \ | |
20 | > --config experimental.lfs.serve=False -R server serve -d \ |
|
19 | > --config experimental.lfs.serve=False -R server serve -d \ | |
21 | > -p $HGPORT --pid-file=hg.pid -A $TESTTMP/access.log -E $TESTTMP/errors.log |
|
20 | > -p $HGPORT --pid-file=hg.pid -A $TESTTMP/access.log -E $TESTTMP/errors.log | |
22 | $ cat hg.pid >> $DAEMON_PIDS |
|
21 | $ cat hg.pid >> $DAEMON_PIDS | |
23 |
|
22 | |||
24 | Uploads fail... |
|
23 | Uploads fail... | |
25 |
|
24 | |||
26 | $ hg init client |
|
25 | $ hg init client | |
27 | $ echo 'this-is-an-lfs-file' > client/lfs.bin |
|
26 | $ echo 'this-is-an-lfs-file' > client/lfs.bin | |
28 | $ hg -R client ci -Am 'initial commit' |
|
27 | $ hg -R client ci -Am 'initial commit' | |
29 | adding lfs.bin |
|
28 | adding lfs.bin | |
30 | $ hg -R client push http://localhost:$HGPORT |
|
29 | $ hg -R client push http://localhost:$HGPORT | |
31 | pushing to http://localhost:$HGPORT/ |
|
30 | pushing to http://localhost:$HGPORT/ | |
32 | searching for changes |
|
31 | searching for changes | |
33 | abort: LFS HTTP error: HTTP Error 400: no such method: .git (action=upload)! |
|
32 | abort: LFS HTTP error: HTTP Error 400: no such method: .git (action=upload)! | |
34 | [255] |
|
33 | [255] | |
35 |
|
34 | |||
36 | ... so do a local push to make the data available. Remove the blob from the |
|
35 | ... so do a local push to make the data available. Remove the blob from the | |
37 | default cache, so it attempts to download. |
|
36 | default cache, so it attempts to download. | |
38 | $ hg --config "lfs.usercache=$TESTTMP/servercache" \ |
|
37 | $ hg --config "lfs.usercache=$TESTTMP/servercache" \ | |
39 | > --config "lfs.url=null://" \ |
|
38 | > --config "lfs.url=null://" \ | |
40 | > -R client push -q server |
|
39 | > -R client push -q server | |
41 | $ mv `hg config lfs.usercache` $TESTTMP/servercache |
|
40 | $ mv `hg config lfs.usercache` $TESTTMP/servercache | |
42 |
|
41 | |||
43 | Downloads fail... |
|
42 | Downloads fail... | |
44 |
|
43 | |||
45 | $ hg clone http://localhost:$HGPORT httpclone |
|
44 | $ hg clone http://localhost:$HGPORT httpclone | |
46 | requesting all changes |
|
45 | requesting all changes | |
47 | adding changesets |
|
46 | adding changesets | |
48 | adding manifests |
|
47 | adding manifests | |
49 | adding file changes |
|
48 | adding file changes | |
50 | added 1 changesets with 1 changes to 1 files |
|
49 | added 1 changesets with 1 changes to 1 files | |
51 | new changesets 525251863cad |
|
50 | new changesets 525251863cad | |
52 | updating to branch default |
|
51 | updating to branch default | |
53 | abort: LFS HTTP error: HTTP Error 400: no such method: .git (action=download)! |
|
52 | abort: LFS HTTP error: HTTP Error 400: no such method: .git (action=download)! | |
54 | [255] |
|
53 | [255] | |
55 |
|
54 | |||
56 | $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS |
|
55 | $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS | |
57 |
|
56 | |||
58 | $ cat $TESTTMP/access.log $TESTTMP/errors.log |
|
57 | $ cat $TESTTMP/access.log $TESTTMP/errors.log | |
59 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) |
|
58 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |
60 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D525251863cad618e55d483555f3d00a2ca99597e x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) |
|
59 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D525251863cad618e55d483555f3d00a2ca99597e x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |
61 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) |
|
60 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |
62 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) |
|
61 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |
63 | $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 400 - (glob) |
|
62 | $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 400 - (glob) | |
64 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) |
|
63 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |
65 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) |
|
64 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |
66 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) |
|
65 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |
67 | $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 400 - (glob) |
|
66 | $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 400 - (glob) | |
68 |
|
67 | |||
69 | Blob URIs are correct when --prefix is used |
|
68 | Blob URIs are correct when --prefix is used | |
70 |
|
69 | |||
71 | $ rm -f $TESTTMP/access.log $TESTTMP/errors.log |
|
70 | $ rm -f $TESTTMP/access.log $TESTTMP/errors.log | |
72 | $ hg --config "lfs.usercache=$TESTTMP/servercache" -R server serve -d \ |
|
71 | $ hg --config "lfs.usercache=$TESTTMP/servercache" -R server serve -d \ | |
73 | > -p $HGPORT --pid-file=hg.pid --prefix=subdir/mount/point \ |
|
72 | > -p $HGPORT --pid-file=hg.pid --prefix=subdir/mount/point \ | |
74 | > -A $TESTTMP/access.log -E $TESTTMP/errors.log |
|
73 | > -A $TESTTMP/access.log -E $TESTTMP/errors.log | |
75 | $ cat hg.pid >> $DAEMON_PIDS |
|
74 | $ cat hg.pid >> $DAEMON_PIDS | |
76 |
|
75 | |||
77 | $ hg --config lfs.url=http://localhost:$HGPORT/subdir/mount/point/.git/info/lfs \ |
|
76 | $ hg --config lfs.url=http://localhost:$HGPORT/subdir/mount/point/.git/info/lfs \ | |
78 | > clone --debug http://localhost:$HGPORT/subdir/mount/point cloned2 |
|
77 | > clone --debug http://localhost:$HGPORT/subdir/mount/point cloned2 | |
79 | using http://localhost:$HGPORT/subdir/mount/point |
|
78 | using http://localhost:$HGPORT/subdir/mount/point | |
80 | sending capabilities command |
|
79 | sending capabilities command | |
81 | query 1; heads |
|
80 | query 1; heads | |
82 | sending batch command |
|
81 | sending batch command | |
83 | requesting all changes |
|
82 | requesting all changes | |
84 | sending getbundle command |
|
83 | sending getbundle command | |
85 | bundle2-input-bundle: with-transaction |
|
84 | bundle2-input-bundle: with-transaction | |
86 | bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported |
|
85 | bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported | |
87 | adding changesets |
|
86 | adding changesets | |
88 | add changeset 525251863cad |
|
87 | add changeset 525251863cad | |
89 | adding manifests |
|
88 | adding manifests | |
90 | adding file changes |
|
89 | adding file changes | |
91 | adding lfs.bin revisions |
|
90 | adding lfs.bin revisions | |
92 | added 1 changesets with 1 changes to 1 files |
|
91 | added 1 changesets with 1 changes to 1 files | |
93 | calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs |
|
92 | calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs | |
94 | bundle2-input-part: total payload size 648 |
|
93 | bundle2-input-part: total payload size 648 | |
95 | bundle2-input-part: "listkeys" (params: 1 mandatory) supported |
|
94 | bundle2-input-part: "listkeys" (params: 1 mandatory) supported | |
96 | bundle2-input-part: "phase-heads" supported |
|
95 | bundle2-input-part: "phase-heads" supported | |
97 | bundle2-input-part: total payload size 24 |
|
96 | bundle2-input-part: total payload size 24 | |
98 | bundle2-input-part: "cache:rev-branch-cache" supported |
|
97 | bundle2-input-part: "cache:rev-branch-cache" supported | |
99 | bundle2-input-part: total payload size 39 |
|
98 | bundle2-input-part: total payload size 39 | |
100 | bundle2-input-bundle: 3 parts total |
|
99 | bundle2-input-bundle: 3 parts total | |
101 | checking for updated bookmarks |
|
100 | checking for updated bookmarks | |
102 | updating the branch cache |
|
101 | updating the branch cache | |
103 | new changesets 525251863cad |
|
102 | new changesets 525251863cad | |
104 | updating to branch default |
|
103 | updating to branch default | |
105 | resolving manifests |
|
104 | resolving manifests | |
106 | branchmerge: False, force: False, partial: False |
|
105 | branchmerge: False, force: False, partial: False | |
107 | ancestor: 000000000000, local: 000000000000+, remote: 525251863cad |
|
106 | ancestor: 000000000000, local: 000000000000+, remote: 525251863cad | |
108 | Status: 200 |
|
107 | Status: 200 | |
109 | Content-Length: 371 |
|
108 | Content-Length: 371 | |
110 | Content-Type: application/vnd.git-lfs+json |
|
109 | Content-Type: application/vnd.git-lfs+json | |
111 | Date: $HTTP_DATE$ |
|
110 | Date: $HTTP_DATE$ | |
112 | Server: testing stub value |
|
111 | Server: testing stub value | |
113 | { |
|
112 | { | |
114 | "objects": [ |
|
113 | "objects": [ | |
115 | { |
|
114 | { | |
116 | "actions": { |
|
115 | "actions": { | |
117 | "download": { |
|
116 | "download": { | |
118 | "expires_at": "$ISO_8601_DATE_TIME$" |
|
117 | "expires_at": "$ISO_8601_DATE_TIME$" | |
119 | "header": { |
|
118 | "header": { | |
120 | "Accept": "application/vnd.git-lfs" |
|
119 | "Accept": "application/vnd.git-lfs" | |
121 | } |
|
120 | } | |
122 | "href": "http://localhost:$HGPORT/subdir/mount/point/.hg/lfs/objects/f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e" |
|
121 | "href": "http://localhost:$HGPORT/subdir/mount/point/.hg/lfs/objects/f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e" | |
123 | } |
|
122 | } | |
124 | } |
|
123 | } | |
125 | "oid": "f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e" |
|
124 | "oid": "f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e" | |
126 | "size": 20 |
|
125 | "size": 20 | |
127 | } |
|
126 | } | |
128 | ] |
|
127 | ] | |
129 | "transfer": "basic" |
|
128 | "transfer": "basic" | |
130 | } |
|
129 | } | |
131 | lfs: downloading f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e (20 bytes) |
|
130 | lfs: downloading f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e (20 bytes) | |
132 | Status: 200 |
|
131 | Status: 200 | |
133 | Content-Length: 20 |
|
132 | Content-Length: 20 | |
134 | Content-Type: application/octet-stream |
|
133 | Content-Type: application/octet-stream | |
135 | Date: $HTTP_DATE$ |
|
134 | Date: $HTTP_DATE$ | |
136 | Server: testing stub value |
|
135 | Server: testing stub value | |
137 | lfs: adding f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e to the usercache |
|
136 | lfs: adding f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e to the usercache | |
138 | lfs: processed: f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e |
|
137 | lfs: processed: f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e | |
139 | lfs.bin: remote created -> g |
|
138 | lfs.bin: remote created -> g | |
140 | getting lfs.bin |
|
139 | getting lfs.bin | |
141 | lfs: found f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e in the local lfs store |
|
140 | lfs: found f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e in the local lfs store | |
142 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
141 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
143 |
|
142 | |||
144 | $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS |
|
143 | $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS | |
145 |
|
144 | |||
146 | $ cat $TESTTMP/access.log $TESTTMP/errors.log |
|
145 | $ cat $TESTTMP/access.log $TESTTMP/errors.log | |
147 | $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point?cmd=capabilities HTTP/1.1" 200 - (glob) |
|
146 | $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point?cmd=capabilities HTTP/1.1" 200 - (glob) | |
148 | $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) |
|
147 | $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |
149 | $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) |
|
148 | $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |
150 | $LOCALIP - - [$LOGDATE$] "POST /subdir/mount/point/.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob) |
|
149 | $LOCALIP - - [$LOGDATE$] "POST /subdir/mount/point/.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob) | |
151 | $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point/.hg/lfs/objects/f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e HTTP/1.1" 200 - (glob) |
|
150 | $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point/.hg/lfs/objects/f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e HTTP/1.1" 200 - (glob) | |
|
151 | ||||
|
152 | $ cat >> $TESTTMP/lfsstoreerror.py <<EOF | |||
|
153 | > import errno | |||
|
154 | > from hgext.lfs import blobstore | |||
|
155 | > | |||
|
156 | > _numverifies = 0 | |||
|
157 | > _readerr = True | |||
|
158 | > | |||
|
159 | > def reposetup(ui, repo): | |||
|
160 | > # Nothing to do with a remote repo | |||
|
161 | > if not repo.local(): | |||
|
162 | > return | |||
|
163 | > | |||
|
164 | > store = repo.svfs.lfslocalblobstore | |||
|
165 | > class badstore(store.__class__): | |||
|
166 | > def download(self, oid, src): | |||
|
167 | > '''Called in the server to handle reading from the client in a | |||
|
168 | > PUT request.''' | |||
|
169 | > origread = src.read | |||
|
170 | > def _badread(nbytes): | |||
|
171 | > # Simulate bad data/checksum failure from the client | |||
|
172 | > return b'0' * len(origread(nbytes)) | |||
|
173 | > src.read = _badread | |||
|
174 | > super(badstore, self).download(oid, src) | |||
|
175 | > | |||
|
176 | > def _read(self, vfs, oid, verify): | |||
|
177 | > '''Called in the server to read data for a GET request, and then | |||
|
178 | > calls self._verify() on it before returning.''' | |||
|
179 | > global _readerr | |||
|
180 | > # One time simulation of a read error | |||
|
181 | > if _readerr: | |||
|
182 | > _readerr = False | |||
|
183 | > raise IOError(errno.EIO, '%s: I/O error' % oid) | |||
|
184 | > # Simulate corrupt content on client download | |||
|
185 | > blobstore._verify(oid, 'dummy content') | |||
|
186 | > | |||
|
187 | > def verify(self, oid): | |||
|
188 | > '''Called in the server to populate the Batch API response, | |||
|
189 | > letting the client re-upload if the file is corrupt.''' | |||
|
190 | > # Fail verify in Batch API for one clone command and one push | |||
|
191 | > # command with an IOError. Then let it through to access other | |||
|
192 | > # functions. Checksum failure is tested elsewhere. | |||
|
193 | > global _numverifies | |||
|
194 | > _numverifies += 1 | |||
|
195 | > if _numverifies <= 2: | |||
|
196 | > raise IOError(errno.EIO, '%s: I/O error' % oid) | |||
|
197 | > return super(badstore, self).verify(oid) | |||
|
198 | > | |||
|
199 | > store.__class__ = badstore | |||
|
200 | > EOF | |||
|
201 | ||||
|
202 | $ rm -rf `hg config lfs.usercache` | |||
|
203 | $ rm -f $TESTTMP/access.log $TESTTMP/errors.log | |||
|
204 | $ hg --config "lfs.usercache=$TESTTMP/servercache" \ | |||
|
205 | > --config extensions.lfsstoreerror=$TESTTMP/lfsstoreerror.py \ | |||
|
206 | > -R server serve -d \ | |||
|
207 | > -p $HGPORT1 --pid-file=hg.pid -A $TESTTMP/access.log -E $TESTTMP/errors.log | |||
|
208 | $ cat hg.pid >> $DAEMON_PIDS | |||
|
209 | ||||
|
210 | Test an I/O error in localstore.verify() (Batch API) with GET | |||
|
211 | ||||
|
212 | $ hg clone http://localhost:$HGPORT1 httpclone2 | |||
|
213 | requesting all changes | |||
|
214 | adding changesets | |||
|
215 | adding manifests | |||
|
216 | adding file changes | |||
|
217 | added 1 changesets with 1 changes to 1 files | |||
|
218 | new changesets 525251863cad | |||
|
219 | updating to branch default | |||
|
220 | abort: LFS server error for "lfs.bin": Internal server error! | |||
|
221 | [255] | |||
|
222 | ||||
|
223 | Test an I/O error in localstore.verify() (Batch API) with PUT | |||
|
224 | ||||
|
225 | $ echo foo > client/lfs.bin | |||
|
226 | $ hg -R client ci -m 'mod lfs' | |||
|
227 | $ hg -R client push http://localhost:$HGPORT1 | |||
|
228 | pushing to http://localhost:$HGPORT1/ | |||
|
229 | searching for changes | |||
|
230 | abort: LFS server error for "unknown": Internal server error! | |||
|
231 | [255] | |||
|
232 | TODO: figure out how to associate the file name in the error above | |||
|
233 | ||||
|
234 | Test a bad checksum sent by the client in the transfer API | |||
|
235 | ||||
|
236 | $ hg -R client push http://localhost:$HGPORT1 | |||
|
237 | pushing to http://localhost:$HGPORT1/ | |||
|
238 | searching for changes | |||
|
239 | abort: HTTP error: HTTP Error 500: Internal Server Error (oid=b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c, action=upload)! | |||
|
240 | [255] | |||
|
241 | ||||
|
242 | $ echo 'test lfs file' > server/lfs3.bin | |||
|
243 | $ hg --config experimental.lfs.disableusercache=True \ | |||
|
244 | > -R server ci -Aqm 'another lfs file' | |||
|
245 | $ hg -R client pull -q http://localhost:$HGPORT1 | |||
|
246 | ||||
|
247 | Test an I/O error during the processing of the GET request | |||
|
248 | ||||
|
249 | $ hg --config lfs.url=http://localhost:$HGPORT1/.git/info/lfs \ | |||
|
250 | > -R client update -r tip | |||
|
251 | abort: HTTP error: HTTP Error 500: Internal Server Error (oid=276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d, action=download)! | |||
|
252 | [255] | |||
|
253 | ||||
|
254 | Test a checksum failure during the processing of the GET request | |||
|
255 | ||||
|
256 | $ hg --config lfs.url=http://localhost:$HGPORT1/.git/info/lfs \ | |||
|
257 | > -R client update -r tip | |||
|
258 | abort: HTTP error: HTTP Error 500: Internal Server Error (oid=276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d, action=download)! | |||
|
259 | [255] | |||
|
260 | ||||
|
261 | $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS | |||
|
262 | ||||
|
263 | $ cat $TESTTMP/access.log | |||
|
264 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
265 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
266 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
267 | $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob) | |||
|
268 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
269 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D392c05922088bacf8e68a6939b480017afbf245d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
270 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
271 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
272 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
273 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
274 | $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob) | |||
|
275 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
276 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D392c05922088bacf8e68a6939b480017afbf245d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
277 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
278 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
279 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
280 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
281 | $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob) | |||
|
282 | $LOCALIP - - [$LOGDATE$] "PUT /.hg/lfs/objects/b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c HTTP/1.1" 500 - (glob) | |||
|
283 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
284 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D392c05922088bacf8e68a6939b480017afbf245d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
285 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=525251863cad618e55d483555f3d00a2ca99597e&heads=506bf3d83f78c54b89e81c6411adee19fdf02156+525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
286 | $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob) | |||
|
287 | $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d HTTP/1.1" 500 - (glob) | |||
|
288 | $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob) | |||
|
289 | $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d HTTP/1.1" 500 - (glob) | |||
|
290 | ||||
|
291 | $ grep -v ' File "' $TESTTMP/errors.log | |||
|
292 | $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/.hg/lfs/objects/b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c': (glob) | |||
|
293 | Traceback (most recent call last): | |||
|
294 | self.do_write() | |||
|
295 | self.do_hgweb() | |||
|
296 | for chunk in self.server.application(env, self._start_response): | |||
|
297 | for r in self._runwsgi(req, res, repo): | |||
|
298 | rctx, req, res, self.check_perm) | |||
|
299 | return func(*(args + a), **kw) | |||
|
300 | lambda perm: | |||
|
301 | localstore.download(oid, req.bodyfh) | |||
|
302 | super(badstore, self).download(oid, src) | |||
|
303 | raise error.Abort(_('corrupt remote lfs object: %s') % oid) | |||
|
304 | Abort: corrupt remote lfs object: b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c | |||
|
305 | ||||
|
306 | $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d': (glob) | |||
|
307 | Traceback (most recent call last): | |||
|
308 | self.do_write() | |||
|
309 | self.do_hgweb() | |||
|
310 | for chunk in self.server.application(env, self._start_response): | |||
|
311 | for r in self._runwsgi(req, res, repo): | |||
|
312 | rctx, req, res, self.check_perm) | |||
|
313 | return func(*(args + a), **kw) | |||
|
314 | lambda perm: | |||
|
315 | res.setbodybytes(localstore.read(oid)) | |||
|
316 | blob = self._read(self.vfs, oid, verify) | |||
|
317 | raise IOError(errno.EIO, '%s: I/O error' % oid) | |||
|
318 | IOError: [Errno 5] 276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d: I/O error | |||
|
319 | ||||
|
320 | $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d': (glob) | |||
|
321 | Traceback (most recent call last): | |||
|
322 | self.do_write() | |||
|
323 | self.do_hgweb() | |||
|
324 | for chunk in self.server.application(env, self._start_response): | |||
|
325 | for r in self._runwsgi(req, res, repo): | |||
|
326 | rctx, req, res, self.check_perm) | |||
|
327 | return func(*(args + a), **kw) | |||
|
328 | lambda perm: | |||
|
329 | res.setbodybytes(localstore.read(oid)) | |||
|
330 | blob = self._read(self.vfs, oid, verify) | |||
|
331 | blobstore._verify(oid, 'dummy content') | |||
|
332 | hint=_('run hg verify')) | |||
|
333 | Abort: detected corrupt lfs object: 276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d | |||
|
334 |
General Comments 0
You need to be logged in to leave comments.
Login now