|
1 | 1 | #!/usr/bin/env bash |
2 | 2 | # See README.md for info on running these tests. |
3 | 3 |
|
| 4 | +testConcurrency1X() { |
| 5 | + LOG_CONCURRENCY=true MEMORY_AVAILABLE=512 capture $(pwd)/profile/nodejs.sh |
| 6 | + assertCaptured "Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)" |
| 7 | + assertCaptured "Recommending WEB_CONCURRENCY=1" |
| 8 | + assertCapturedSuccess |
| 9 | +} |
| 10 | + |
| 11 | +testConcurrency2X() { |
| 12 | + LOG_CONCURRENCY=true MEMORY_AVAILABLE=1024 capture $(pwd)/profile/nodejs.sh |
| 13 | + assertCaptured "Detected 1024 MB available memory, 512 MB limit per process (WEB_MEMORY)" |
| 14 | + assertCaptured "Recommending WEB_CONCURRENCY=2" |
| 15 | + assertCapturedSuccess |
| 16 | +} |
| 17 | + |
| 18 | +testConcurrencyPX() { |
| 19 | + LOG_CONCURRENCY=true MEMORY_AVAILABLE=6144 capture $(pwd)/profile/nodejs.sh |
| 20 | + assertCaptured "Detected 6144 MB available memory, 512 MB limit per process (WEB_MEMORY)" |
| 21 | + assertCaptured "Recommending WEB_CONCURRENCY=12" |
| 22 | + assertCapturedSuccess |
| 23 | +} |
| 24 | + |
| 25 | +testConcurrencyCustomLimit() { |
| 26 | + LOG_CONCURRENCY=true MEMORY_AVAILABLE=1024 WEB_MEMORY=256 capture $(pwd)/profile/nodejs.sh |
| 27 | + assertCaptured "Detected 1024 MB available memory, 256 MB limit per process (WEB_MEMORY)" |
| 28 | + assertCaptured "Recommending WEB_CONCURRENCY=4" |
| 29 | + assertCapturedSuccess |
| 30 | +} |
| 31 | + |
| 32 | +testConcurrencySaneMaximum() { |
| 33 | + LOG_CONCURRENCY=true MEMORY_AVAILABLE=6144 WEB_MEMORY=32 capture $(pwd)/profile/nodejs.sh |
| 34 | + assertCaptured "Detected 6144 MB available memory, 32 MB limit per process (WEB_MEMORY)" |
| 35 | + assertCaptured "Recommending WEB_CONCURRENCY=32" |
| 36 | + assertCapturedSuccess |
| 37 | +} |
| 38 | + |
4 | 39 | testInvalidNode() { |
5 | 40 | compile "invalid-node" |
6 | 41 | assertCaptured "Downloading and installing node 0.11.33" |
@@ -404,38 +439,6 @@ testMultiExport() { |
404 | 439 | assertCapturedSuccess |
405 | 440 | } |
406 | 441 |
|
407 | | -testConcurrency1X() { |
408 | | - MEMORY_AVAILABLE=512 capture $(pwd)/profile/nodejs.sh |
409 | | - assertEquals "$WEB_CONCURRENCY" "1" |
410 | | - assertCapturedSuccess |
411 | | -} |
412 | | - |
413 | | -testConcurrency2X() { |
414 | | - MEMORY_AVAILABLE=1024 capture $(pwd)/profile/nodejs.sh |
415 | | - assertEquals "$WEB_CONCURRENCY" "2" |
416 | | - assertCapturedSuccess |
417 | | -} |
418 | | - |
419 | | -testConcurrencyPX() { |
420 | | - MEMORY_AVAILABLE=6144 capture $(pwd)/profile/nodejs.sh |
421 | | - assertEquals "$WEB_CONCURRENCY" "12" |
422 | | - assertCapturedSuccess |
423 | | -} |
424 | | - |
425 | | -testConcurrencyCustomLimit() { |
426 | | - MEMORY_AVAILABLE=1024 WEB_MEMORY=256 capture $(pwd)/profile/nodejs.sh |
427 | | - assertEquals "$WEB_CONCURRENCY" "4" |
428 | | - assertCapturedSuccess |
429 | | -} |
430 | | - |
431 | | -testConcurrencySaneMaximum() { |
432 | | - MEMORY_AVAILABLE=6144 WEB_MEMORY=32 capture $(pwd)/profile/nodejs.sh |
433 | | - assertCaptured "Detected 6144 MB available memory, 32 MB limit per process (WEB_MEMORY)" |
434 | | - assertCaptured "Recommending WEB_CONCURRENCY=32" |
435 | | - assertCapturedSuccess |
436 | | -} |
437 | | - |
438 | | - |
439 | 442 | # Utils |
440 | 443 |
|
441 | 444 | pushd $(dirname 0) >/dev/null |
|
0 commit comments