-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest.bash
executable file
·61 lines (45 loc) · 1.21 KB
/
test.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
set -e
if [ -z "$B2_APP_KEY" ]; then
echo "Set \$B2_APP_KEY"
exit 1
fi
if [ -z "$B2_ACCOUNT_ID" ]; then
echo "Set \$B2_ACCOUNT_ID"
exit 1
fi
DIR="$(pwd)/integration-test"
if [ -e "$DIR" ]; then
chmod -R a+w "$DIR"
rm -rf "$DIR"
fi
mkdir "$DIR"
mkdir "$DIR/bin"
go build -o "$DIR/bin/git-annex-remote-b2"
export PATH="$DIR/bin:$PATH"
pushd "$DIR"
git init
git annex init
BUCKET_NAME="git-annex-test-$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
git annex initremote noencrypt type=external externaltype=b2 encryption=none bucket="$BUCKET_NAME" prefix=raw
git annex initremote --fast encrypt type=external externaltype=b2 encryption=shared bucket="$BUCKET_NAME" prefix=enc
cp bin/git-annex-remote-b2 somefile
git annex add somefile
git commit -m 'commit'
git annex copy --to noencrypt
git annex fsck --from noencrypt
git annex drop
git annex move --from noencrypt
git annex fsck --from noencrypt
git annex copy --to encrypt
git annex fsck --from encrypt
git annex drop
git annex move --from encrypt
git annex fsck --from encrypt
git annex testremote --fast encrypt
git annex testremote --fast noencrypt
popd
chmod -R a+w "$DIR"
rm -rf "$DIR"
echo "Passed!"
exit 0