Skip to content

Commit

Permalink
Merge pull request #24 from Medium/nick-local
Browse files Browse the repository at this point in the history
fix heap space option, and add tests
  • Loading branch information
nicks committed Jun 23, 2015
2 parents 28ee0a4 + c64c1ba commit 43799a0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function launch(options, port) {
]

if (options.heap) {
args.push('-Xmx=' + options.heap)
args.push('-Xmx' + options.heap)
}

args.push(
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "local-dynamo",
"description": "A Node.js wrapper of AWS DynamoDB Local and utilities",
"version": "0.1.0",
"version": "0.1.1",
"homepage": "https://github.com/Medium/local-dynamo",
"licenses": [
{
Expand All @@ -23,13 +23,17 @@
"type": "git",
"url": "https://github.com/Medium/local-dynamo.git"
},
"scripts": {
"test": "./node_modules/.bin/nodeunit test"
},
"dependencies": {
"flags": "0.1.2",
"kew": "0.4.0",
"metrics": "0.1.8",
"progress": "1.1.8"
},
"devDependencies": {
"aws-sdk": "^2.0.22"
"aws-sdk": "^2.0.22",
"nodeunit": "0.9.1"
}
}
33 changes: 33 additions & 0 deletions test/launch_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2015 A Medium Corporation.

var localDynamo = require('../lib/launch')

exports.testMemory = function (test) {
var dynamo = localDynamo.launch({
port: 8676,
heap: '512m'
})
dynamo.stdout.on('data', function (data) {
console.log('stdout', data.toString())
})
dynamo.stderr.on('data', function (data) {
console.log('stderr', data.toString())
})

var finished = false

dynamo.on('exit', function (code) {
if (finished) return

finished = true
test.ok(false, 'Unexpected exit code ' + code)
test.done()
})

// If everything goes well after 5 seconds, then we're done!
setTimeout(function () {
finished = true
dynamo.kill()
test.done()
}, 5000).unref()
}

0 comments on commit 43799a0

Please sign in to comment.