-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: revert few stdin tests that were removed #3144
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
Kubuxu
added
status/in-progress
In progress
need/review
Needs a review
and removed
status/in-progress
In progress
labels
Aug 29, 2016
@jbenet this brings changeset in t0040-add-and-cat.sh from 0.4.2 to: diff --git a/test/sharness/t0040-add-and-cat.sh b/test/sharness/t0040-add-and-cat.sh
index a37c605..038a53c 100755
--- a/test/sharness/t0040-add-and-cat.sh
+++ b/test/sharness/t0040-add-and-cat.sh
@@ -8,18 +8,16 @@ test_description="Test add and cat commands"
. lib/test-lib.sh
-client_err_add() {
- printf "$@\n\n"
- echo 'USAGE
- ipfs add <path>... - Add a file or directory to ipfs.
+test_add_cat_file() {
+ test_expect_success "ipfs add --help works" '
+ ipfs add --help 2> add_help_err > /dev/null
+ '
- Adds contents of <path> to ipfs. Use -r to add directories (recursively).
+ test_expect_success "stdin reading message doesnt show up" '
+ test_expect_code 1 grep "ipfs: Reading from" add_help_err &&
+ test_expect_code 1 grep "send Ctrl-d to stop." add_help_err
+ '
-Use '"'"'ipfs add --help'"'"' for more information about this command.
-'
-}
-
-test_add_cat_file() {
test_expect_success "ipfs add succeeds" '
echo "Hello Worlds!" >mountdir/hello.txt &&
ipfs add mountdir/hello.txt >actual
@@ -75,6 +73,17 @@ test_add_cat_file() {
echo "added $HASH hello.txt" >expected &&
test_cmp expected actual
'
+
+ test_expect_success "ipfs add on hidden file succeeds" '
+ echo "Hello Worlds!" >mountdir/.hello.txt &&
+ ipfs add mountdir/.hello.txt >actual
+ '
+
+ test_expect_success "ipfs add on hidden file output looks good" '
+ HASH="QmVr26fY1tKyspEJBniVhqxQeEjhF78XerGiqWAwraVLQH" &&
+ echo "added $HASH .hello.txt" >expected &&
+ test_cmp expected actual
+ '
}
test_add_cat_5MB() {
@@ -163,9 +172,10 @@ test_add_named_pipe() {
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_add "Error: Unrecognized file type for named-pipe: $(generic_stat named-pipe)" >expected &&
rm named-pipe &&
- test_cmp expected actual
+ grep "Error: Unrecognized file type for named-pipe: $(generic_stat named-pipe)" actual &&
+ grep USAGE actual &&
+ grep "ipfs add" actual
'
test_expect_success "useful error message when recursively adding a named pipe" '
@@ -210,7 +220,7 @@ test_expect_success "ipfs cat output looks good" '
test_cmp expected actual
'
-test_expect_success "ipfs cat accept hash from stdin" '
+test_expect_success "ipfs cat accept hash from built input" '
echo "$HASH" | ipfs cat >actual
'
@@ -266,11 +276,11 @@ test_expect_success "'ipfs add' output looks good" '
test_cmp expected actual
'
-test_expect_success "'ipfs cat' with stdin input succeeds" '
+test_expect_success "'ipfs cat' with built input succeeds" '
echo "$HASH" | ipfs cat >actual
'
-test_expect_success "ipfs cat with stdin input output looks good" '
+test_expect_success "ipfs cat with built input output looks good" '
printf "Hello Neptune!\nHello Pluton!" >expected &&
test_cmp expected actual
'
@@ -317,7 +327,7 @@ test_expect_success "'ipfs add -rn' output looks good" '
test_cmp expected actual
'
-test_expect_success "ipfs cat accept many hashes from stdin" '
+test_expect_success "ipfs cat accept many hashes from built input" '
{ echo "$MARS"; echo "$VENUS"; } | ipfs cat >actual
'
@@ -352,9 +362,10 @@ test_expect_success "ipfs cat output looks good" '
test_cmp expected actual
'
+
test_expect_success "go-random is installed" '
- type random
- '
+ type random
+'
test_add_cat_5MB
@@ -379,4 +390,11 @@ test_expect_success "ipfs cat file fails" '
test_add_named_pipe ""
+# Test daemon in offline mode
+test_launch_ipfs_daemon --offline
+
+test_add_cat_file
+
+test_kill_ipfs_daemon
+
test_done |
LGTM, thanks @Kubuxu! |
LGTM. please link it into the review issue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
License: MIT
Signed-off-by: Jakub Sztandera [email protected]