xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame^] | 1 | <testcase> |
| 2 | <info> |
| 3 | <keywords> |
| 4 | HTTP |
| 5 | HTTP GET |
| 6 | --no-clobber |
| 7 | </keywords> |
| 8 | </info> |
| 9 | |
| 10 | # |
| 11 | # Server-side |
| 12 | <reply> |
| 13 | <data nocheck="yes"> |
| 14 | HTTP/1.0 200 OK |
| 15 | Connection: close |
| 16 | Content-Type: text/plain |
| 17 | Content-Length: 4 |
| 18 | |
| 19 | foo |
| 20 | </data> |
| 21 | </reply> |
| 22 | |
| 23 | # |
| 24 | # Client-side |
| 25 | <client> |
| 26 | <name> |
| 27 | HTTP GET without clobber when 100 files already exist |
| 28 | </name> |
| 29 | <server> |
| 30 | http |
| 31 | </server> |
| 32 | <features> |
| 33 | http |
| 34 | </features> |
| 35 | <command option="no-output"> |
| 36 | http://%HOSTIP:%HTTPPORT/%TESTNUMBER -o log/exist%TESTNUMBER --no-clobber |
| 37 | </command> |
| 38 | <file name="log/exist%TESTNUMBER"> |
| 39 | to stay the same |
| 40 | </file> |
| 41 | <precheck> |
| 42 | perl -e 'for my $i ((1..100)) { my $filename = "log/exist%TESTNUMBER.$i"; open(FH, ">", $filename) or die $!; print FH "to stay the same" ; close(FH) }' |
| 43 | # python3 -c 'for i in range(1, 101): open("log/exist%TESTNUMBER.{}".format(i), mode="w").write("to stay the same")' |
| 44 | </precheck> |
| 45 | <postcheck> |
| 46 | perl -e 'for my $i ((1..100)) { my $filename = "log/exist%TESTNUMBER.$i"; open(FH, "<", $filename) or die $!; (<FH> eq "to stay the same" and <FH> eq "") or die "incorrect $filename" ; close(FH) }' |
| 47 | # python3 -c 'for i in range(1, 101): assert open("log/exist%TESTNUMBER.{}".format(i), mode="r").read(17) == "to stay the same"' |
| 48 | </postcheck> |
| 49 | </client> |
| 50 | |
| 51 | # |
| 52 | # Verify data after the test has been "shot" |
| 53 | <verify> |
| 54 | <errorcode> |
| 55 | 23 |
| 56 | </errorcode> |
| 57 | <file name="log/exist%TESTNUMBER"> |
| 58 | to stay the same |
| 59 | </file> |
| 60 | </verify> |
| 61 | </testcase> |