aboutsummaryrefslogtreecommitdiffstats
path: root/tests/t0107-snapshot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/t0107-snapshot.sh')
-rwxr-xr-xtests/t0107-snapshot.sh77
1 files changed, 38 insertions, 39 deletions
diff --git a/tests/t0107-snapshot.sh b/tests/t0107-snapshot.sh
index 132d2e9..4fbe45e 100755
--- a/tests/t0107-snapshot.sh
+++ b/tests/t0107-snapshot.sh
@@ -1,77 +1,76 @@
1#!/bin/sh 1#!/bin/sh
2 2
3test_description='Verify snapshot'
3. ./setup.sh 4. ./setup.sh
4 5
5prepare_tests "Verify snapshot" 6test_expect_success 'get foo/snapshot/master.tar.gz' '
6 7 cgit_url "foo/snapshot/master.tar.gz" >tmp
7run_test 'get foo/snapshot/master.tar.gz' '
8 cgit_url "foo/snapshot/master.tar.gz" >trash/tmp
9' 8'
10 9
11run_test 'check html headers' ' 10test_expect_success 'check html headers' '
12 head -n 1 trash/tmp | 11 head -n 1 tmp |
13 grep "Content-Type: application/x-gzip" && 12 grep "Content-Type: application/x-gzip" &&
14 13
15 head -n 2 trash/tmp | 14 head -n 2 tmp |
16 grep "Content-Disposition: inline; filename=.master.tar.gz." 15 grep "Content-Disposition: inline; filename=.master.tar.gz."
17' 16'
18 17
19run_test 'strip off the header lines' ' 18test_expect_success 'strip off the header lines' '
20 tail -n +6 trash/tmp > trash/master.tar.gz 19 tail -n +6 tmp > master.tar.gz
21' 20'
22 21
23run_test 'verify gzip format' ' 22test_expect_success 'verify gzip format' '
24 gunzip --test trash/master.tar.gz 23 gunzip --test master.tar.gz
25' 24'
26 25
27run_test 'untar' ' 26test_expect_success 'untar' '
28 rm -rf trash/master && 27 rm -rf master &&
29 tar -xf trash/master.tar.gz -C trash 28 tar -xf master.tar.gz
30' 29'
31 30
32run_test 'count files' ' 31test_expect_success 'count files' '
33 c=$(ls -1 trash/master/ | wc -l) && 32 ls master/ >output &&
34 test $c = 5 33 test_line_count = 5 output
35' 34'
36 35
37run_test 'verify untarred file-5' ' 36test_expect_success 'verify untarred file-5' '
38 grep "^5$" trash/master/file-5 && 37 grep "^5$" master/file-5 &&
39 test $(cat trash/master/file-5 | wc -l) = 1 38 test_line_count = 1 master/file-5
40' 39'
41 40
42run_test 'get foo/snapshot/master.zip' ' 41test_expect_success 'get foo/snapshot/master.zip' '
43 cgit_url "foo/snapshot/master.zip" >trash/tmp 42 cgit_url "foo/snapshot/master.zip" >tmp
44' 43'
45 44
46run_test 'check HTML headers (zip)' ' 45test_expect_success 'check HTML headers (zip)' '
47 head -n 1 trash/tmp | 46 head -n 1 tmp |
48 grep "Content-Type: application/x-zip" && 47 grep "Content-Type: application/x-zip" &&
49 48
50 head -n 2 trash/tmp | 49 head -n 2 tmp |
51 grep "Content-Disposition: inline; filename=.master.zip." 50 grep "Content-Disposition: inline; filename=.master.zip."
52' 51'
53 52
54run_test 'strip off the header lines (zip)' ' 53test_expect_success 'strip off the header lines (zip)' '
55 tail -n +6 trash/tmp >trash/master.zip 54 tail -n +6 tmp >master.zip
56' 55'
57 56
58run_test 'verify zip format' ' 57test_expect_success 'verify zip format' '
59 unzip -t trash/master.zip 58 unzip -t master.zip
60' 59'
61 60
62run_test 'unzip' ' 61test_expect_success 'unzip' '
63 rm -rf trash/master && 62 rm -rf master &&
64 unzip trash/master.zip -d trash 63 unzip master.zip
65' 64'
66 65
67run_test 'count files (zip)' ' 66test_expect_success 'count files (zip)' '
68 c=$(ls -1 trash/master/ | wc -l) && 67 ls master/ >output &&
69 test $c = 5 68 test_line_count = 5 output
70' 69'
71 70
72run_test 'verify unzipped file-5' ' 71test_expect_success 'verify unzipped file-5' '
73 grep "^5$" trash/master/file-5 && 72 grep "^5$" master/file-5 &&
74 test $(cat trash/master/file-5 | wc -l) = 1 73 test_line_count = 1 master/file-5
75' 74'
76 75
77tests_done 76test_done