@cryptotaxi247 / kubo / commits / f947931af

git: add git plugin tests

License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>

Łukasz Magiera committed Jul 12, 2017 at 23:37 UTC f947931af97811260cbaaa516ff09ae4c30d5229
2 files changed +31 -1
test/sharness/t0280-plugin-git-data/git.tar.gz
Binary files /dev/null and b/test/sharness/t0280-plugin-git-data/git.tar.gz differ
test/sharness/t0280-plugin-git.sh
+31 -1
@@ -22,6 +22,36 @@ test_expect_success "copy plugin" '
22 cp ../plugins/git.so "$IPFS_PATH/plugins/"
23 '
24
25 -# test here
25 +# from https://github.com/ipfs/go-ipld-git/blob/master/make-test-repo.sh
26 +test_expect_success "prepare test data" '
27 + tar xzf ../t0280-plugin-git-data/git.tar.gz
28 +'
29 +
30 +test_dag_git() {
31 + test_expect_success "add objects via dag put" '
32 + find objects -type f -exec ipfs dag put --format=git --input-enc=zlib {} \; -exec echo \; > hashes
33 + '
34 +
35 + test_expect_success "successfully get added objects" '
36 + cat hashes | xargs -i ipfs dag get -- {} > /dev/null
37 + '
38 +
39 + test_expect_success "path traversals work" '
40 + echo \"YmxvYiA3ACcsLnB5Zgo=\" > file1 &&
41 + ipfs dag get z8mWaJh5RLq16Zwgtd8gZxd63P4hgwNNx/object/parents/0/tree/dir2/hash/f3/hash > out1
42 + '
43 +
44 + test_expect_success "outputs look correct" '
45 + test_cmp file1 out1
46 + '
47 +}
48 +
49 +# should work offline
50 +#test_dag_git
51 +
52 +# should work online
53 +test_launch_ipfs_daemon
54 +test_dag_git
55 +test_kill_ipfs_daemon
56
57 test_done