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
1b26ca72
Commit
1b26ca72
authored
Sep 04, 2015
by
rht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for ipfs add err for unsupported file type
License: MIT Signed-off-by:
rht
<
rhtbot@gmail.com
>
parent
ccc9cd6a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
0 deletions
+52
-0
test/sharness/lib/test-lib.sh
test/sharness/lib/test-lib.sh
+14
-0
test/sharness/t0040-add-and-cat.sh
test/sharness/t0040-add-and-cat.sh
+19
-0
test/sharness/t0041-add-cat-offline.sh
test/sharness/t0041-add-cat-offline.sh
+19
-0
No files found.
test/sharness/lib/test-lib.sh
View file @
1b26ca72
...
...
@@ -330,3 +330,17 @@ disk_usage() {
esac
$DU
"
$1
"
|
awk
"{print
\$
1}"
}
# output a file's permission in human readable format
generic_stat
()
{
# normalize stat across systems
case
$(
uname
-s
)
in
Linux
)
_STAT
=
"stat -c %A"
;;
FreeBSD
|
Darwin
|
DragonFly
)
_STAT
=
"stat -f %Sp"
;;
esac
$_STAT
"
$1
"
}
test/sharness/t0040-add-and-cat.sh
View file @
1b26ca72
...
...
@@ -8,6 +8,10 @@ test_description="Test add and cat commands"
.
lib/test-lib.sh
client_err
()
{
printf
"
$@
\n\n
Use 'ipfs add --help' for information about this command
\n
"
}
test_launch_ipfs_daemon_and_mount
test_expect_success
"'ipfs add --help' succeeds"
'
...
...
@@ -262,6 +266,21 @@ test_expect_success FUSE,EXPENSIVE "cat ipfs/bigfile looks good" '
test_cmp sha1_expected sha1_actual
'
test_expect_success
"useful error message when adding a named pipe"
'
mkfifo named-pipe &&
test_expect_code 1 ipfs add named-pipe 2>actual &&
client_err "Error: Unrecognized file type for named-pipe: $(generic_stat named-pipe)" >expected &&
test_cmp expected actual
'
test_expect_success
"useful error message when recursively adding a named pipe"
'
mkdir named-pipe-dir &&
mkfifo named-pipe-dir/named-pipe &&
test_expect_code 1 ipfs add -r named-pipe-dir 2>actual &&
printf "Error: Post http://127.0.0.1:$PORT_API/api/v0/add?encoding=json&progress=true&r=true&stream-channels=true: Unrecognized file type for named-pipe-dir/named-pipe: $(generic_stat named-pipe-dir/named-pipe)\n" >expected &&
test_cmp expected actual
'
test_kill_ipfs_daemon
test_done
test/sharness/t0041-add-cat-offline.sh
View file @
1b26ca72
...
...
@@ -8,6 +8,10 @@ test_description="Test add and cat commands"
.
lib/test-lib.sh
client_err
()
{
printf
"
$@
\n\n
Use 'ipfs add --help' for information about this command
\n
"
}
test_init_ipfs
test_expect_success
"ipfs add file succeeds"
'
...
...
@@ -53,4 +57,19 @@ test_expect_success "ipfs cat file fails" '
test_must_fail ipfs cat $(cat oh_hash)
'
test_expect_success
"useful error message when adding a named pipe"
'
mkfifo named-pipe &&
test_expect_code 1 ipfs add named-pipe 2>actual &&
client_err "Error: Unrecognized file type for named-pipe: $(generic_stat named-pipe)" >expected &&
test_cmp expected actual
'
test_expect_success
"useful error message when recursively adding a named pipe"
'
mkdir named-pipe-dir &&
mkfifo named-pipe-dir/named-pipe &&
test_expect_code 1 ipfs add -r named-pipe-dir 2>actual &&
printf "Error: Unrecognized file type for named-pipe-dir/named-pipe: $(generic_stat named-pipe-dir/named-pipe)\n" >expected &&
test_cmp expected actual
'
test_done
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