-
-
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
t0080: prepare for online tests #933
Conversation
Put the tests into a function so that they can easily be run both offline and online. Unfortunately it is not possible to run them both offline and online right now because there are some "Error: context deadline exceeded" when the online tests are run if the offline tests have been run before. This is explained in a comment and the online tests are commented out for now. License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
# ...but unfortunately doesn't work right now | ||
# there are some "Error: context deadline exceeded" | ||
# when running the online tests after the offline tests | ||
# if the offline tests are commented out, it works |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's bizarre. know which commands in question fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will have a look. And maybe try to come up with a small test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I have the following:
> cat poll_apiout
time="2015-03-20T22:06:37Z" level=debug msg=starting timeout=1s tries=60 url="http://127.0.0.1:5836/version" when=2015-03-20 22:06:37.538776907 +0000 UTC
time="2015-03-20T22:06:37Z" level=debug msg="get failed" error="wrong url or endpoint error from http.Get() &url.Error{Op:\"Get\", URL:\"http://127.0.0.1:5836/version\", Err:(*net.OpError)(0xc2080323c0)}" tries=60
time="2015-03-20T22:06:38Z" level=debug msg="get failed" error="wrong url or endpoint error from http.Get() &url.Error{Op:\"Get\", URL:\"http://127.0.0.1:5836/version\", Err:(*net.OpError)(0xc2080324c0)}" tries=59
time="2015-03-20T22:06:39Z" level=debug msg="get failed" error="wrong url or endpoint error from http.Get() &url.Error{Op:\"Get\", URL:\"http://127.0.0.1:5836/version\", Err:(*net.OpError)(0xc208032600)}" tries=58
...
when waiting with pollEndpoint for the daemon to be started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following test can be used to reproduce:
#!/bin/sh
#
# Copyright (c) 2014 Jeromy Johnson
# MIT Licensed; see the LICENSE file in this repository.
#
test_description="Test ipfs repo operations"
. lib/test-lib.sh
test_init_ipfs
# we use a function so that we can run it both offline + online
test_repo_cmd() {
test_expect_success "file no longer pinned" '
# we expect the welcome files to show up here
echo "$HASH_WELCOME_DOCS" >expected2 &&
ipfs refs -r "$HASH_WELCOME_DOCS" >>expected2 &&
WHASH=QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn &&
echo "$WHASH" >> expected2 &&
sort expected2 >expected_sorted2 &&
ipfs pin ls -type=recursive >actual2 &&
sort actual2 >actual_sorted2 &&
test_cmp expected_sorted2 actual_sorted2
'
test_expect_success "'ipfs pin rm' succeeds" '
true >empty &&
ipfs pin rm -r "$WHASH" &&
ipfs pin ls >rm_actual &&
test_cmp empty rm_actual &&
ipfs pin rm -r "$HASH_WELCOME_DOCS" &&
ipfs pin ls -type=recursive >rm_actual &&
test_cmp empty rm_actual
'
test_expect_success "'ipfs repo gc' succeeds" '
ipfs repo gc >gc_out_actual
'
test_expect_success "'ipfs repo gc' looks good" '
echo "removed $WHASH" >>gc_out_expected &&
echo "removed $HASH_WELCOME_DOCS" >>gc_out_expected &&
sort gc_out_actual >gc_out_actual_sorted &&
sort gc_out_expected >gc_out_expected_sorted &&
test_cmp gc_out_expected_sorted gc_out_actual_sorted
'
}
# should work offline
test_repo_cmd
echo "HASH: $HASH"
echo "WHASH: $WHASH"
echo "MBLOCKHASH: $MBLOCKHASH"
echo "HASH_WELCOME_DOCS: $HASH_WELCOME_DOCS"
echo "DIRECTPIN: $DIRECTPIN"
# should work online...
# ...but unfortunately doesn't work right now
# there are some "Error: context deadline exceeded"
# when running the online tests after the offline tests
# if the offline tests are commented out, it works
test_launch_ipfs_daemon
test_repo_cmd
test_kill_ipfs_daemon
test_done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can reproduce the bug with the following smaller test script:
|
It fails for me with:
|
closing due to inactivity, please reopen as necessary note: all pull requests older than three weeks may be closed in an effort to keep our open pull requests more focused. |
Put the tests into a function so that they
can easily be run both offline and online.
Unfortunately it is not possible to run them
both offline and online right now because there
are some "Error: context deadline exceeded"
when the online tests are run if the offline
tests have been run before. This is explained
in a comment and the online tests are commented
out for now.
License: MIT
Signed-off-by: Christian Couder chriscool@tuxfamily.org