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

Use memory chunk store for unit tests #871

Merged
merged 1 commit into from Jul 23, 2016
Merged

Conversation

@yciabaud
Copy link
Contributor

yciabaud commented Jul 21, 2016

The webseed tests were not using fixtures module but passed anyway because the fs store was already populated with the data of a previous test.

This PR uses memory chunk store to ensure the store is empty before running a test.

Corrected webseed test to follow fixtures and tracker magnet.
@@ -15,7 +16,7 @@ test('Download using HTTP tracker (via magnet uri)', function (t) {
})

function magnetDownloadTest (t, serverType) {
t.plan(10)
t.plan(11)

This comment has been minimized.

Copy link
@yciabaud

yciabaud Jul 21, 2016

Author Contributor

This test was not passing with an empty store, I assume this is the good number.

This comment has been minimized.

Copy link
@feross

feross Jul 23, 2016

Member

It looks like 10 is the right number, we should figure out why this needed to be changed to 11 to pass with an empty store.

This comment has been minimized.

Copy link
@feross

feross Jul 23, 2016

Member

Okay, so this was a timing thing. Basically now noPeers is getting emitted twice because the tracker gets sent a 'started' then a 'completed' message and both times there are no peers in the response. I changed the .on('noPeers') to .once('noPeers') so this will be more reliable.

This comment has been minimized.

Copy link
@yciabaud

yciabaud Jul 23, 2016

Author Contributor

Ok thank you

This comment has been minimized.

Copy link
@feross
@@ -10,7 +11,7 @@ var WebTorrent = require('../../')
test('Download using webseed (via magnet uri)', function (t) {
t.plan(9)

var serve = serveStatic(path.join(__dirname, 'content'))
var serve = serveStatic(path.dirname(fixtures.leaves.contentPath))

This comment has been minimized.

Copy link
@yciabaud

yciabaud Jul 21, 2016

Author Contributor

Assets are now in the fixtures module.

This comment has been minimized.

Copy link
@feross

feross Jul 23, 2016

Member

Good catch!

@yciabaud

This comment has been minimized.

Copy link
Contributor Author

yciabaud commented Jul 21, 2016

I focused on downloading tests but maybe all the tests are concerned.

@feross feross merged commit 28bd2d6 into webtorrent:master Jul 23, 2016
3 checks passed
3 checks passed
Node Security No known vulnerabilities found
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
feross added a commit that referenced this pull request Jul 23, 2016
Okay, so this was a timing thing. Basically now noPeers is getting
emitted twice because the tracker gets sent a 'started' then a
'completed' message and both times there are no peers in the response.
I changed the .on('noPeers') to .once('noPeers') so this will be more
reliable.

#871 (comment)
@lock

This comment has been minimized.

Copy link

lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.