Sharness: add test for compression level
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
rht committed
Sep 22, 2015 at 16:38 UTC
43dbd1cdb9e26cd3496c6db5308297c15c520be0
1 file changed
+25
-29
test/sharness/t0090-get.sh
+25
-29
@@ -10,6 +10,28 @@ test_description="Test get command"
10
11
test_init_ipfs
12
13
+test_ipfs_get_flag() {
14
+ ext="$1"; shift
15
+ tar_flag="$1"; shift
16
+ flag="$@"
17
+
18
+ test_expect_success "ipfs get $flag succeeds" '
19
+ ipfs get "$HASH" '"$flag"' >actual
20
+ '
21
+
22
+ test_expect_success "ipfs get $flag output looks good" '
23
+ printf "%s\n\n" "Saving archive to $HASH$ext" >expected &&
24
+ test_cmp expected actual
25
+ '
26
+
27
+ test_expect_success "ipfs get $flag archive output is valid" '
28
+ tar "$tar_flag" "$HASH$ext" &&
29
+ test_cmp "$HASH" data &&
30
+ rm "$HASH$ext" &&
31
+ rm "$HASH"
32
+ '
33
+}
34
+
35
# we use a function so that we can run it both offline + online
36
test_get_cmd() {
37
@@ -42,37 +64,11 @@ test_get_cmd() {
64
rm "$HASH"
65
'
66
45
- test_expect_success "ipfs get -a succeeds" '
46
- ipfs get "$HASH" -a >actual
47
- '
67
+ test_ipfs_get_flag ".tar" "-xf" -a
68
49
- test_expect_success "ipfs get -a output looks good" '
50
- printf "%s\n\n" "Saving archive to $HASH.tar" >expected &&
51
- test_cmp expected actual
52
- '
69
+ test_ipfs_get_flag ".tar.gz" "-zxf" -a -C
70
54
- test_expect_success "ipfs get -a archive output is valid" '
55
- tar -xf "$HASH".tar &&
56
- test_cmp "$HASH" data &&
57
- rm "$HASH".tar &&
58
- rm "$HASH"
59
- '
60
-
61
- test_expect_success "ipfs get -a -C succeeds" '
62
- ipfs get "$HASH" -a -C >actual
63
- '
64
-
65
- test_expect_success "ipfs get -a -C output looks good" '
66
- printf "%s\n\n" "Saving archive to $HASH.tar.gz" >expected &&
67
- test_cmp expected actual
68
- '
69
-
70
- test_expect_success "gzipped tar archive output is valid" '
71
- tar -zxf "$HASH".tar.gz &&
72
- test_cmp "$HASH" data &&
73
- rm "$HASH".tar.gz &&
74
- rm "$HASH"
75
- '
71
+ test_ipfs_get_flag ".tar.gz" "-zxf" -a -C -l 9
72
73
test_expect_success "ipfs get succeeds (directory)" '
74
mkdir -p dir &&