Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
686882bd
Commit
686882bd
authored
8 years ago
by
Jeromy Johnson
Committed by
GitHub
8 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3148 from ipfs/test/improve-verify
Improve sharness testing on ipfs repo verify
parents
050985c5
7baac76a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
test/sharness/t0086-repo-verify.sh
test/sharness/t0086-repo-verify.sh
+60
-0
No files found.
test/sharness/t0086-repo-verify.sh
0 → 100755
View file @
686882bd
#!/bin/sh
#
# Copyright (c) 2016 Jeromy Johnson
# MIT Licensed; see the LICENSE file in this repository.
#
test_description
=
"Test ipfs repo fsck"
.
lib/test-lib.sh
test_init_ipfs
sort_rand
()
{
case
`
uname
`
in
Linux
)
sort
-R
;;
Darwin
)
ruby
-e
'puts STDIN.readlines.shuffle'
;;
*
)
echo
"unsupported system:
$(
uname
)
"
esac
}
check_random_corruption
()
{
to_break
=
$(
find
"
$IPFS_PATH
/blocks"
-type
f | sort_rand |
head
-n
1
)
test_expect_success
"back up file and overwrite it"
'
cp "$to_break" backup_file &&
echo "this is super broken" > "$to_break"
'
test_expect_success
"repo verify detects failure"
'
test_expect_code 1 ipfs repo verify
'
test_expect_success
"replace the object"
'
cp backup_file "$to_break"
'
test_expect_success
"ipfs repo verify passes just fine now"
'
ipfs repo verify
'
}
test_expect_success
"create some files"
'
random-files -depth=3 -dirs=4 -files=10 foobar > /dev/null
'
test_expect_success
"add them all"
'
ipfs add -r -q foobar > /dev/null
'
for
i
in
`
seq
20
`
do
check_random_corruption
done
test_done
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment