Skip to content

Commit

Permalink
Add unit tests around WEB_CONCURRENCY behavior
Browse files Browse the repository at this point in the history
WEB_CONCURRENCY should be allowed to be set prior to the `profile.d`
scripts running. This change adds tests to make sure we do not
accidentally clobber preset values.

These tests were extracted from a different change that duplicated
behavior for WEB_CONCURRENCY handling. See the [associated PR][1] for
more information around the discussion.

[1]: #876
  • Loading branch information
michaelherold committed Jan 19, 2021
1 parent 2c82606 commit 2f28f2e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## main
- Update node version to 14 ([#885](https://github.com/heroku/heroku-buildpack-nodejs/pull/885))
- Add unit tests around the behavior of `WEB_CONCURRENCY` ([#876](https://github.com/heroku/heroku-buildpack-nodejs/pull/876))

# v182 (2020-01-05)
- add Node 14.15.3 and 15.5.0 to inventory ([#881](https://github.com/heroku/heroku-buildpack-nodejs/pull/881))
Expand Down
16 changes: 16 additions & 0 deletions test/unit
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,22 @@ testBuildDataPreviousBuild() {
assertEquals "$(meta_get test)" ""
}

testWebConcurrencyDoesNotOverrideManualValue() {
WEB_CONCURRENCY=123

source "$(pwd)"/profile/WEB_CONCURRENCY.sh

assertEquals 123 "$WEB_CONCURRENCY"
}

testWebConcurrencySetsAValueWhenUnset() {
unset WEB_CONCURRENCY

source "$(pwd)"/profile/WEB_CONCURRENCY.sh

assertNotNull "WEB_CONCURRENCY is null" "$WEB_CONCURRENCY"
}

testWebConcurrencyProfileScript() {
# this was set when we sourced the WEB_CONCURRENCY.sh file
unset WEB_MEMORY
Expand Down

0 comments on commit 2f28f2e

Please sign in to comment.