Skip to content

Commit 164a754

Browse files
committed
fix: use assertCapturedSuccessWithWarnings for tests using EOL Node versions
Functional tests using EOL Node fixtures now produce stderr output from the EOL warning. Switch from assertCapturedSuccess (which requires empty stderr) to assertCapturedSuccessWithWarnings (which only checks exit code).
1 parent 1177d36 commit 164a754

4 files changed

Lines changed: 85 additions & 85 deletions

File tree

test/run-general

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ testBuildScriptBehavior() {
1313
# The 'build' script is run by default
1414
compile "build-script"
1515
assertCaptured "Running build"
16-
assertCapturedSuccess
16+
assertCapturedSuccessWithWarnings
1717

1818
# the 'heroku-postbuild' script takes precedence over the 'build' script
1919
compile "build-script-override"
2020
assertCaptured "Detected both \"build\" and \"heroku-postbuild\" scripts"
2121
assertCaptured "Running heroku-postbuild"
22-
assertCapturedSuccess
22+
assertCapturedSuccessWithWarnings
2323
}
2424

2525

@@ -38,7 +38,7 @@ testBuildFlags() {
3838
assertCaptured "Running build"
3939
assertCaptured "Running with --prod --optimize flags"
4040
assertCaptured 'echo build hook message "--prod --optimize"'
41-
assertCapturedSuccess
41+
assertCapturedSuccessWithWarnings
4242
}
4343

4444

@@ -47,7 +47,7 @@ testPreferEmptyHerokuPostbuildOverBuild() {
4747
assertCaptured "Detected both \"build\" and \"heroku-postbuild\" scripts"
4848
assertCaptured "Running heroku-postbuild"
4949
assertNotCaptured "build hook message"
50-
assertCapturedSuccess
50+
assertCapturedSuccessWithWarnings
5151
}
5252

5353

@@ -57,20 +57,20 @@ testPrePostBuildScripts() {
5757
assertCaptured "echo heroku-prebuild hook message"
5858
assertCaptured "Running heroku-postbuild"
5959
assertCaptured "echo heroku-postbuild hook message"
60-
assertCapturedSuccess
60+
assertCapturedSuccessWithWarnings
6161

6262
compile "stable-node"
6363
assertNotCaptured "Running heroku-prebuild"
6464
assertNotCaptured "Running heroku-postbuild"
65-
assertCapturedSuccess
65+
assertCapturedSuccessWithWarnings
6666
}
6767

6868

6969
testCleanupScript() {
7070
compile "cleanup-scripts"
7171
assertCaptured "Running heroku-cleanup"
7272
assertCaptured "echo heroku-cleanup hook message"
73-
assertCapturedSuccess
73+
assertCapturedSuccessWithWarnings
7474
}
7575

7676

@@ -91,7 +91,7 @@ testCustomNodeBinaryURL() {
9191
compile "node-14" $cache $env_dir
9292
assertCaptured "from https://nodejs.org/download/release/v14.21.3/node-v14.21.3-linux-x64.tar.gz"
9393
assertNotCaptured "Validating checksum"
94-
assertCapturedSuccess
94+
assertCapturedSuccessWithWarnings
9595
}
9696

9797

@@ -113,16 +113,16 @@ testDisableCache() {
113113
compile "node-modules-cache-1" $cache $env_dir
114114
assertCaptured "lodash@1.0.0"
115115
assertEquals "1" "$(ls -1 $cache/node/cache/node_modules | grep -c lodash | tr -d ' ')"
116-
assertCapturedSuccess
116+
assertCapturedSuccessWithWarnings
117117

118118
compile "node-modules-cache-2" $cache $env_dir
119119
assertCaptured "lodash@1.0.0"
120-
assertCapturedSuccess
120+
assertCapturedSuccessWithWarnings
121121

122122
echo "false" > $env_dir/NODE_MODULES_CACHE
123123
compile "node-modules-cache-2" $cache $env_dir
124124
assertCaptured "lodash@1.3.1"
125-
assertCapturedSuccess
125+
assertCapturedSuccessWithWarnings
126126
}
127127

128128

@@ -132,7 +132,7 @@ testNodeModulesCached() {
132132
compile "caching" $cache
133133
assertCaptured "- node_modules"
134134
assertEquals "1" "$(ls -1 $cache/node/cache/node_modules | grep -c express | tr -d ' ')"
135-
assertCapturedSuccess
135+
assertCapturedSuccessWithWarnings
136136
}
137137

138138

@@ -155,17 +155,17 @@ testBuildWithCache() {
155155
compile "stable-node" $cache
156156
assertNotCaptured "Restoring cache"
157157
assertEquals "1" "$(ls -1 $cache/node/cache/node_modules | grep -c @heroku | tr -d ' ')"
158-
assertCapturedSuccess
158+
assertCapturedSuccessWithWarnings
159159

160160
compile "stable-node" $cache
161161
assertCaptured "- node_modules"
162162
assertFileContains "${STACK}" "${cache}/node/signature"
163-
assertCapturedSuccess
163+
assertCapturedSuccessWithWarnings
164164

165165
rm -rf "$cache/node/cache/node_modules"
166166
compile "stable-node" $cache
167167
assertCaptured "- node_modules (not cached - skipping)"
168-
assertCapturedSuccess
168+
assertCapturedSuccessWithWarnings
169169
}
170170

171171

@@ -271,7 +271,7 @@ testDotHerokuCollision() {
271271
compile "dot-heroku-collision-2"
272272
assertCaptured "Build succeeded!"
273273
assertNotCaptured ".heroku file is checked into this project"
274-
assertCapturedSuccess
274+
assertCapturedSuccessWithWarnings
275275
}
276276

277277

@@ -290,9 +290,9 @@ testMultipleRuns() {
290290

291291
cp -a test/fixtures/stable-node/. ${compileDir}
292292
compileDir "$compileDir" "$cacheDir"
293-
assertCapturedSuccess
293+
assertCapturedSuccessWithWarnings
294294
compileDir "$compileDir" "$cacheDir"
295-
assertCapturedSuccess
295+
assertCapturedSuccessWithWarnings
296296
}
297297

298298

@@ -319,54 +319,54 @@ testBuildWithUserCacheDirectoriesCamel() {
319319
assertCaptured "- non/existent (nothing to cache)"
320320
assertEquals "1" "$(ls -1 $cache/node/cache/server | grep -c node_modules | tr -d ' ')"
321321
assertEquals "1" "$(ls -1 $cache/node/cache/client | grep -c node_modules | tr -d ' ')"
322-
assertCapturedSuccess
322+
assertCapturedSuccessWithWarnings
323323

324324
compile "cache-directories-camel" $cache
325325
assertCaptured "Loading from cacheDirectories"
326326
assertCaptured "- server/node_modules"
327327
assertCaptured "- client/node_modules"
328328
assertCaptured "- non/existent (not cached - skipping)"
329-
assertCapturedSuccess
329+
assertCapturedSuccessWithWarnings
330330
}
331331

332332

333333
testConcurrency1X() {
334334
LOG_CONCURRENCY=true MEMORY_AVAILABLE=512 capture "$(pwd)"/profile/WEB_CONCURRENCY.sh
335335
assertCaptured "Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)"
336336
assertCaptured "Recommending WEB_CONCURRENCY=1"
337-
assertCapturedSuccess
337+
assertCapturedSuccessWithWarnings
338338
}
339339

340340

341341
testConcurrency2X() {
342342
LOG_CONCURRENCY=true MEMORY_AVAILABLE=1024 capture "$(pwd)"/profile/WEB_CONCURRENCY.sh
343343
assertCaptured "Detected 1024 MB available memory, 512 MB limit per process (WEB_MEMORY)"
344344
assertCaptured "Recommending WEB_CONCURRENCY=2"
345-
assertCapturedSuccess
345+
assertCapturedSuccessWithWarnings
346346
}
347347

348348

349349
testConcurrencyPerformanceM() {
350350
LOG_CONCURRENCY=true MEMORY_AVAILABLE=2560 capture "$(pwd)"/profile/WEB_CONCURRENCY.sh
351351
assertCaptured "Detected 2560 MB available memory, 512 MB limit per process (WEB_MEMORY)"
352352
assertCaptured "Recommending WEB_CONCURRENCY=5"
353-
assertCapturedSuccess
353+
assertCapturedSuccessWithWarnings
354354
}
355355

356356

357357
testConcurrencyPerformanceL() {
358358
LOG_CONCURRENCY=true MEMORY_AVAILABLE=14336 capture "$(pwd)"/profile/WEB_CONCURRENCY.sh
359359
assertCaptured "Detected 14336 MB available memory, 512 MB limit per process (WEB_MEMORY)"
360360
assertCaptured "Recommending WEB_CONCURRENCY=28"
361-
assertCapturedSuccess
361+
assertCapturedSuccessWithWarnings
362362
}
363363

364364

365365
testConcurrencyCustomLimit() {
366366
LOG_CONCURRENCY=true MEMORY_AVAILABLE=1024 WEB_MEMORY=256 capture "$(pwd)"/profile/WEB_CONCURRENCY.sh
367367
assertCaptured "Detected 1024 MB available memory, 256 MB limit per process (WEB_MEMORY)"
368368
assertCaptured "Recommending WEB_CONCURRENCY=4"
369-
assertCapturedSuccess
369+
assertCapturedSuccessWithWarnings
370370
}
371371

372372
# When /sys/fs/cgroup/memory/memory.limit_in_bytes lies and gives a ridiculous value
@@ -376,7 +376,7 @@ testConcurrencyTooHigh() {
376376
LOG_CONCURRENCY=true MEMORY_AVAILABLE=10000000000 capture "$(pwd)"/profile/WEB_CONCURRENCY.sh
377377
assertCaptured "Could not determine a reasonable value for WEB_CONCURRENCY"
378378
assertCaptured "Recommending WEB_CONCURRENCY=1"
379-
assertCapturedSuccess
379+
assertCapturedSuccessWithWarnings
380380
}
381381

382382

@@ -405,27 +405,27 @@ testSignatureInvalidation() {
405405

406406
compile "node-0.12.6" $cache
407407
assertCaptured "Downloading and installing node 0.12.6"
408-
assertCapturedSuccess
408+
assertCapturedSuccessWithWarnings
409409

410410
compile "node-0.12.7" $cache
411411
assertCaptured "Downloading and installing node 0.12.7"
412412
assertCaptured "Cached directories were not restored due to a change in version of node"
413-
assertCapturedSuccess
413+
assertCapturedSuccessWithWarnings
414414
}
415415

416416

417417
testModulesCheckedIn() {
418418
cache=$(mktmpdir)
419419
compile "modules-checked-in" $cache
420-
assertCapturedSuccess
420+
assertCapturedSuccessWithWarnings
421421

422422
compile "modules-checked-in" $cache
423423
assertCaptured "Prebuild detected"
424424
assertCaptured "Rebuilding any native modules"
425425
assertCaptured "(preinstall script)"
426426
assertCaptured "Installing any new modules"
427427
assertCaptured "(postinstall script)"
428-
assertCapturedSuccess
428+
assertCapturedSuccessWithWarnings
429429
}
430430

431431

@@ -468,23 +468,23 @@ testSpecificVersion() {
468468
assertCaptured "Resolving node version"
469469
assertCaptured "Downloading and installing node 14.15.3"
470470
assertCaptured "Using default npm version: 6.14.9"
471-
assertCapturedSuccess
471+
assertCapturedSuccessWithWarnings
472472
}
473473

474474

475475
testStableVersion() {
476476
compile "stable-node"
477477
assertCaptured "Downloading and installing node 0.10."
478478
assertNotCaptured "We're sorry this build is failing"
479-
assertCapturedSuccess
479+
assertCapturedSuccessWithWarnings
480480
}
481481

482482

483483
testUnstableVersion() {
484484
compile "unstable-version"
485485
assertCaptured "Resolving node version 0.11.x"
486486
assertCaptured "Downloading and installing node 0.11."
487-
assertCapturedSuccess
487+
assertCapturedSuccessWithWarnings
488488
}
489489

490490

@@ -528,7 +528,7 @@ testRangeWithSpace() {
528528
compile "range-with-space"
529529
assertCaptured "Resolving node version = 0.8.x"
530530
assertCaptured "Downloading and installing node"
531-
assertCapturedSuccess
531+
assertCapturedSuccessWithWarnings
532532
}
533533

534534

@@ -549,27 +549,27 @@ testBuildWithUserCacheDirectories() {
549549
assertCaptured "Saving cacheDirectories"
550550
assertEquals "1" "$(ls -1 $cache/node/cache | grep -c bower_components | tr -d ' ')"
551551
assertEquals "1" "$(ls -1 $cache/node/cache | grep -c node_modules | tr -d ' ')"
552-
assertCapturedSuccess
552+
assertCapturedSuccessWithWarnings
553553

554554
compile "cache-directories" $cache
555555
assertCaptured "Loading from cacheDirectories"
556556
assertCaptured "- node_modules"
557557
assertCaptured "- bower_components"
558-
assertCapturedSuccess
558+
assertCapturedSuccessWithWarnings
559559
}
560560

561561

562562
testDefaultProcType() {
563563
release "stable-node"
564564
assertCaptured "web: npm start"
565-
assertCapturedSuccess
565+
assertCapturedSuccessWithWarnings
566566
}
567567

568568

569569
testDynamicProcfile() {
570570
compile "dynamic-procfile"
571571
assertFileContains "web: node index.js customArg" "${compile_dir}/Procfile"
572-
assertCapturedSuccess
572+
assertCapturedSuccessWithWarnings
573573
}
574574

575575

@@ -580,7 +580,7 @@ testEnvVars() {
580580
compile "stable-node" "$(mktmpdir)" $env_dir
581581
assertCaptured "NPM_CONFIG_PRODUCTION=false"
582582
assertCaptured "USE_NPM_INSTALL=true"
583-
assertCapturedSuccess
583+
assertCapturedSuccessWithWarnings
584584
}
585585

586586

@@ -590,7 +590,7 @@ testNonFileEnvVars() {
590590
compile "stable-node"
591591
assertCaptured "NPM_CONFIG_FOO=bar"
592592
assertCaptured "NPM_CONFIG_PRODUCTION=false"
593-
assertCapturedSuccess
593+
assertCapturedSuccessWithWarnings
594594
unset NPM_CONFIG_FOO
595595
unset NPM_CONFIG_PRODUCTION
596596
}
@@ -606,7 +606,7 @@ testModulesCheckedInWithDevDependencies() {
606606
assertCaptured "Rebuilding any native modules"
607607
assertCaptured "lodash"
608608
assertCaptured "removed 1 package"
609-
assertCapturedSuccess
609+
assertCapturedSuccessWithWarnings
610610
}
611611

612612

@@ -616,7 +616,7 @@ testModulesCheckedInWithoutDevDependencies() {
616616
assertCaptured "added 1 package"
617617
assertCaptured "lodash"
618618
assertCaptured "removed 1 package"
619-
assertCapturedSuccess
619+
assertCapturedSuccessWithWarnings
620620
}
621621

622622

@@ -625,7 +625,7 @@ testProfileExport() {
625625
assertCaptured "Creating runtime environment"
626626
assertFileContains "export PATH=\"\$HOME/.heroku/node/bin:\$HOME/.heroku/yarn/bin:\$PATH:\$HOME/bin:\$HOME/node_modules/.bin\"" "${compile_dir}/.profile.d/nodejs.sh"
627627
assertFileContains "export NODE_HOME=\"\$HOME/.heroku/node\"" "${compile_dir}/.profile.d/nodejs.sh"
628-
assertCapturedSuccess
628+
assertCapturedSuccessWithWarnings
629629
}
630630

631631

@@ -639,14 +639,14 @@ testMultiExport() {
639639
assertFileContains "/.heroku/node\"" "${bp_dir}/export"
640640
# shellcheck disable=SC2016
641641
assertFileContains 'export NODE_OPTIONS=${NODE_OPTIONS:-"--max_old_space_size=2560"}' "${bp_dir}/export"
642-
assertCapturedSuccess
642+
assertCapturedSuccessWithWarnings
643643
}
644644

645645

646646
testCIEnvVars() {
647647
compileTest "ci-env-test"
648648
assertCaptured "NODE_ENV: test"
649-
assertCapturedSuccess
649+
assertCapturedSuccessWithWarnings
650650
}
651651

652652

@@ -657,7 +657,7 @@ testCIEnvVarsOverride() {
657657
compileTest "ci-env-test" "$(mktmpdir)" $env_dir
658658

659659
assertCaptured "NODE_ENV: banana"
660-
assertCapturedSuccess
660+
assertCapturedSuccessWithWarnings
661661
}
662662

663663

@@ -679,7 +679,7 @@ testAvoidHttpProxyVersionResolutionIssue() {
679679
# from the proxy
680680
echo "amazonaws.com" > $env_dir/NO_PROXY
681681
compile "node-14" "$(mktmpdir)" $env_dir
682-
assertCapturedSuccess
682+
assertCapturedSuccessWithWarnings
683683
}
684684

685685

0 commit comments

Comments
 (0)