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 excessive Memory Usage #1211

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

rudimentary test memory usage bugs

  • Loading branch information
disarticulate committed Oct 25, 2017
commit 32d6e2a5e1998d2fbe2e9da6894bb7fbdb28368e

Large diffs are not rendered by default.

@@ -27,6 +27,7 @@
},
"dependencies": {
"addr-to-ip-port": "^1.4.2",
"base64-img": "^1.0.3",
"bitfield": "^1.1.2",
"bittorrent-dht": "^7.2.2",
"bittorrent-protocol": "^2.1.5",
@@ -118,7 +119,7 @@
"test": "standard && node ./bin/test.js",
"test-browser": "zuul -- test/*.js test/browser/*.js",
"test-browser-headless": "zuul --electron -- test/*.js test/browser/*.js",
"test-browser-local": "zuul --local -- test/*.js test/browser/*.js",
"test-browser-local": "zuul --local --open -- test/*.js test/browser/*.js",
"test-node": "tape test/*.js test/node/*.js",
"update-authors": "./bin/update-authors.sh"
}
@@ -1,10 +1,20 @@
var Buffer = require('safe-buffer').Buffer
var test = require('tape')
var WebTorrent = require('../../')
var fs = require('fs')

var img = Buffer.from('R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7', 'base64')
var data = fs.readFileSync('test/browser/data/data2.3MB.base64')
var img = Buffer.from(data, 'base64')
img.name = 'img.png'

var data2 = fs.readFileSync('test/browser/data/data2.5MB.base64')
var img2 = Buffer.from(data2, 'base64')
img2.name = 'img2.png'

var data3 = fs.readFileSync('test/browser/data/data2.7MB.base64')
var img3 = Buffer.from(data3, 'base64')
img3.name = 'img3.png'

function verifyImage (t, err, elem) {
t.error(err)
t.ok(typeof elem.src === 'string')
@@ -112,3 +122,17 @@ test('WebTorrent.WEBRTC_SUPPORT', function (t) {
t.error(err, 'client destroyed')
})
})

test('seed Multiple Torrents', function (t) {
t.plan(3)
var client = new WebTorrent({ dht: false, tracker: false })
client.seed(img, function (torrent) {
t.equal(torrent.infoHash,'fe83c6629dc58cc08b7809256000ad068a167b95')
})
client.seed(img2, function (torrent) {
t.equal(torrent.infoHash, 'fd5c8c050571e1f8c369541ed5560f7696931e3f')
})
client.seed(img3, function (torrent) {
t.equal(torrent.infoHash,'2b12aaf42343ce8dc999cfe36a3da318b22bacf2')
})
})
@@ -0,0 +1,16 @@
var base64Img = require('base64-img')

var data = base64Img.base64Sync('data/data2.3MB.JPG')
fs.writeFileSync('data/data2.3MB.base64', data, 'utf-8')

var data = base64Img.base64Sync('data/PANO_20160512_133940.jpg')
fs.writeFileSync('data/data2.5MB.base64', data, 'utf-8')

var data = base64Img.base64Sync('data/PANO_20160519_101201.jpg')
fs.writeFileSync('data/data2.7MB.base64', data, 'utf-8')

var data = base64Img.base64Sync('data/PANO_20160525_154617.jpg')
fs.writeFileSync('data/data2.9MB.base64', data, 'utf-8')

var data = base64Img.base64Sync('data/PANO_20160518_102006.jpg')
fs.writeFileSync('data/data3.4MB.base64', data, 'utf-8')

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,7 @@
{
"name": "test",
"version": "0.0.0",
"browserify": {
"transform": ["brfs"]
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.