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

Harden Sharness #288

Merged
merged 1 commit into from
Jan 10, 2018
Merged

Harden Sharness #288

merged 1 commit into from
Jan 10, 2018

Conversation

ZenGround0
Copy link
Collaborator

Recent sharness failures prompted more investigation. In particular sharness cleanup does not run cleanup functions on failure (see here: https://github.com/chriscool/sharness/blob/master/sharness.sh#L763). To ensure isolation among test failures we need reliable teardown of ipfs and cluster between each testfile so now the cleanup functions are run directly before test_done.

Error messages are also slightly improved.

The current test-lib.sh already ensures that there is no data folder with rm -rf ipfs-cluster-data after the config folder is created.

Altogether this should close #181.

Better error messages in test-lib init functions and ipfshttp
Cleanup functions are now called after every test file

License: MIT
Signed-off-by: Wyatt Daviau <wdaviau@cs.stanford.edu>
@ghost ghost assigned ZenGround0 Jan 9, 2018
@ghost ghost added the status/in-progress In progress label Jan 9, 2018
@ZenGround0 ZenGround0 requested a review from hsanjuan January 9, 2018 19:26
@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 72.877% when pulling a99b403 on fix/sharness into bda2674 on master.

Copy link
Collaborator

@hsanjuan hsanjuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, but I still think that test-lib.sh can probably be hardened and beautified a bit

@@ -31,4 +29,7 @@ test_expect_success "starting a second cluster-service process fails" '
test_expect_code 1 ipfs-cluster-service --config "test-config"
'

test_clean_ipfs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm it seems that cleanup ... does not clean when the tests have failed (even though documentation says it does? https://github.com/chriscool/sharness/blob/master/API.md#final_cleanup).

I understand this fixes that? The reason clean up does not run on that case is probably to allow the user to debug things. I'm fine with this though, since debugging implies running stuff locally and we can then potentially comment this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It was tough to see this because as you say the docs are a bit misleading. But it explained behavior we saw and I'm reasonably confident after looking at sharness source (see link above)

My thoughts exactly. It makes sense if you want a single failure to stop everything so you can debug, but running this on CI we don't even have a chance to investigate the left over state.

@hsanjuan
Copy link
Collaborator

merge if you want @ZenGround0

@ZenGround0
Copy link
Collaborator Author

@hsanjuan Will do. I'll leave the harden sharness issue open as it sounds like you have more in mind. If you are looking to offload that work make sure to write down your thoughts on the issue because right now I'm drawing a blank on what else needs to be done.

@ZenGround0 ZenGround0 merged commit a4d8aac into master Jan 10, 2018
@ghost ghost removed the status/in-progress In progress label Jan 10, 2018
@hsanjuan hsanjuan mentioned this pull request Jan 17, 2018
@hsanjuan hsanjuan deleted the fix/sharness branch March 29, 2018 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Harden sharness/lib/test-lib.sh
3 participants