Skip to content
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 1 commit into from
Aug 31, 2016

Conversation

Kubuxu
Copy link
Member

@Kubuxu Kubuxu commented Aug 29, 2016

License: MIT
Signed-off-by: Jakub Sztandera kubuxu@protonmail.ch

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
@Kubuxu Kubuxu added status/in-progress In progress need/review Needs a review and removed status/in-progress In progress labels Aug 29, 2016
@Kubuxu Kubuxu added this to the ipfs-0.4.3-rc4 milestone Aug 29, 2016
@Kubuxu
Copy link
Member Author

Kubuxu commented Aug 30, 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

@whyrusleeping
Copy link
Member

LGTM, thanks @Kubuxu!

@jbenet
Copy link
Member

jbenet commented Aug 31, 2016

LGTM. please link it into the review issue

@whyrusleeping whyrusleeping merged commit 4286cd3 into version/0.4.3-rc4 Aug 31, 2016
@whyrusleeping whyrusleeping deleted the test/add/revert branch August 31, 2016 05:03
@jbenet jbenet mentioned this pull request Aug 31, 2016
58 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/review Needs a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants