Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
heroku-buildpack-nodejs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
heroku-buildpack-nodejs
Commits
e0dfe97d
Commit
e0dfe97d
authored
Jul 24, 2015
by
Hunter Loftis
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #254 from heroku/fix-web-concurrency-tests
Fix web concurrency tests
parents
b464cd2a
043067eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
37 deletions
+44
-37
nodejs.sh
profile/nodejs.sh
+9
-1
run
test/run
+35
-36
No files found.
profile/nodejs.sh
View file @
e0dfe97d
...
...
@@ -10,6 +10,11 @@ calculate_concurrency() {
WEB_CONCURRENCY
=
$WEB_CONCURRENCY
}
log_concurrency
()
{
echo
"Detected
$MEMORY_AVAILABLE
MB available memory,
$WEB_MEMORY
MB limit per process (WEB_MEMORY)"
echo
"Recommending WEB_CONCURRENCY=
$WEB_CONCURRENCY
"
}
detect_memory
()
{
local
default
=
$1
local
limit
=
$(
ulimit
-u
)
...
...
@@ -24,10 +29,13 @@ detect_memory() {
export
PATH
=
"
$HOME
/.heroku/node/bin:
$HOME
/bin:
$HOME
/node_modules/.bin:
$PATH
"
export
NODE_HOME
=
"
$HOME
/.heroku/node"
export
NODE_ENV
=
${
NODE_ENV
:-
production
}
calculate_concurrency
export
MEMORY_AVAILABLE
=
$MEMORY_AVAILABLE
export
WEB_MEMORY
=
$WEB_MEMORY
export
WEB_CONCURRENCY
=
$WEB_CONCURRENCY
if
[
"
$LOG_CONCURRENCY
"
=
"true"
]
;
then
log_concurrency
fi
test/run
View file @
e0dfe97d
#!/usr/bin/env bash
# See README.md for info on running these tests.
testConcurrency1X
()
{
LOG_CONCURRENCY
=
true
MEMORY_AVAILABLE
=
512 capture
$(
pwd
)
/profile/nodejs.sh
assertCaptured
"Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)"
assertCaptured
"Recommending WEB_CONCURRENCY=1"
assertCapturedSuccess
}
testConcurrency2X
()
{
LOG_CONCURRENCY
=
true
MEMORY_AVAILABLE
=
1024 capture
$(
pwd
)
/profile/nodejs.sh
assertCaptured
"Detected 1024 MB available memory, 512 MB limit per process (WEB_MEMORY)"
assertCaptured
"Recommending WEB_CONCURRENCY=2"
assertCapturedSuccess
}
testConcurrencyPX
()
{
LOG_CONCURRENCY
=
true
MEMORY_AVAILABLE
=
6144 capture
$(
pwd
)
/profile/nodejs.sh
assertCaptured
"Detected 6144 MB available memory, 512 MB limit per process (WEB_MEMORY)"
assertCaptured
"Recommending WEB_CONCURRENCY=12"
assertCapturedSuccess
}
testConcurrencyCustomLimit
()
{
LOG_CONCURRENCY
=
true
MEMORY_AVAILABLE
=
1024
WEB_MEMORY
=
256 capture
$(
pwd
)
/profile/nodejs.sh
assertCaptured
"Detected 1024 MB available memory, 256 MB limit per process (WEB_MEMORY)"
assertCaptured
"Recommending WEB_CONCURRENCY=4"
assertCapturedSuccess
}
testConcurrencySaneMaximum
()
{
LOG_CONCURRENCY
=
true
MEMORY_AVAILABLE
=
6144
WEB_MEMORY
=
32 capture
$(
pwd
)
/profile/nodejs.sh
assertCaptured
"Detected 6144 MB available memory, 32 MB limit per process (WEB_MEMORY)"
assertCaptured
"Recommending WEB_CONCURRENCY=32"
assertCapturedSuccess
}
testInvalidNode
()
{
compile
"invalid-node"
assertCaptured
"Downloading and installing node 0.11.33"
...
...
@@ -404,42 +439,6 @@ testMultiExport() {
assertCapturedSuccess
}
testConcurrency1X
()
{
MEMORY_AVAILABLE
=
512 capture
$(
pwd
)
/profile/nodejs.sh
assertCaptured
"Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)"
assertCaptured
"Recommending WEB_CONCURRENCY=1"
assertCapturedSuccess
}
testConcurrency2X
()
{
MEMORY_AVAILABLE
=
1024 capture
$(
pwd
)
/profile/nodejs.sh
assertCaptured
"Detected 1024 MB available memory, 512 MB limit per process (WEB_MEMORY)"
assertCaptured
"Recommending WEB_CONCURRENCY=2"
assertCapturedSuccess
}
testConcurrencyPX
()
{
MEMORY_AVAILABLE
=
6144 capture
$(
pwd
)
/profile/nodejs.sh
assertCaptured
"Detected 6144 MB available memory, 512 MB limit per process (WEB_MEMORY)"
assertCaptured
"Recommending WEB_CONCURRENCY=12"
assertCapturedSuccess
}
testConcurrencyCustomLimit
()
{
MEMORY_AVAILABLE
=
1024
WEB_MEMORY
=
256 capture
$(
pwd
)
/profile/nodejs.sh
assertCaptured
"Detected 1024 MB available memory, 256 MB limit per process (WEB_MEMORY)"
assertCaptured
"Recommending WEB_CONCURRENCY=4"
assertCapturedSuccess
}
testConcurrencySaneMaximum
()
{
MEMORY_AVAILABLE
=
6144
WEB_MEMORY
=
32 capture
$(
pwd
)
/profile/nodejs.sh
assertCaptured
"Detected 6144 MB available memory, 32 MB limit per process (WEB_MEMORY)"
assertCaptured
"Recommending WEB_CONCURRENCY=32"
assertCapturedSuccess
}
# Utils
pushd
$(
dirname
0
)
>
/dev/null
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment