Skip to content

Commit

Permalink
Add tests to the nodejs-function meta-buildpack (#44)
Browse files Browse the repository at this point in the history
* Add tests to the nodejs-function meta-buildpack

Ticket:

https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07AH0000008mOuYAI/view

The "regular" nodejs metabuildpack is already tested under test/meta-buildpack/nodejs. This adds local files to ensure that the functions metabuildpack can be built without errors.

* Make nodejs-function not depend on heroku/nodejs

* Swap test and regular buildpack.toml

Before we were accidentally using the docker images in test:

```
$  pack buildpack package test --config test/meta-buildpacks/nodejs-function/package.toml  -v
Downloading buildpack from URI: file:///Users/rschneeman/Documents/projects/work/cnb/buildpacks-nodejs/test/meta-buildpacks/nodejs-function
Downloading buildpack from image: public.ecr.aws/heroku-buildpacks/heroku-nodejs-engine-buildpack@sha256:4fa85f23b1df1138039ec6f5667da48da2af7858767b8840a754c54b39b42ca1
Pulling image public.ecr.aws/heroku-buildpacks/heroku-nodejs-engine-buildpack@sha256:4fa85f23b1df1138039ec6f5667da48da2af7858767b8840a754c54b39b42ca1
public.ecr.aws/heroku-buildpacks/heroku-nodejs-engine-buildpack@sha256:4fa85f23b1df1138039ec6f5667da48da2af7858767b8840a754c54b39b42ca1: Pulling from heroku-buildpacks/heroku-nodejs-engine-buildpack
Digest: sha256:4fa85f23b1df1138039ec6f5667da48da2af7858767b8840a754c54b39b42ca1
Status: Image is up to date for public.ecr.aws/heroku-buildpacks/heroku-nodejs-engine-buildpack@sha256:4fa85f23b1df1138039ec6f5667da48da2af7858767b8840a754c54b39b42ca1
Downloading buildpack from image: public.ecr.aws/heroku-buildpacks/heroku-nodejs-npm-buildpack@sha256:248ce84d07d2b9a11ca2433aee91bec48b2e029aac968e14f57711fe4270159a
Pulling image public.ecr.aws/heroku-buildpacks/heroku-nodejs-npm-buildpack@sha256:248ce84d07d2b9a11ca2433aee91bec48b2e029aac968e14f57711fe4270159a
public.ecr.aws/heroku-buildpacks/heroku-nodejs-npm-buildpack@sha256:248ce84d07d2b9a11ca2433aee91bec48b2e029aac968e14f57711fe4270159a: Pulling from heroku-buildpacks/heroku-nodejs-npm-buildpack
Digest: sha256:248ce84d07d2b9a11ca2433aee91bec48b2e029aac968e14f57711fe4270159a
Status: Image is up to date for public.ecr.aws/heroku-buildpacks/heroku-nodejs-npm-buildpack@sha256:248ce84d07d2b9a11ca2433aee91bec48b2e029aac968e14f57711fe4270159a
Downloading buildpack from image: public.ecr.aws/heroku-buildpacks/heroku-nodejs-typescript-buildpack@sha256:accfc74412af9702c86d370f6289dc9674acc33023369e68f9687b6b4a1b63bd
Pulling image public.ecr.aws/heroku-buildpacks/heroku-nodejs-typescript-buildpack@sha256:accfc74412af9702c86d370f6289dc9674acc33023369e68f9687b6b4a1b63bd
public.ecr.aws/heroku-buildpacks/heroku-nodejs-typescript-buildpack@sha256:accfc74412af9702c86d370f6289dc9674acc33023369e68f9687b6b4a1b63bd: Pulling from heroku-buildpacks/heroku-nodejs-typescript-buildpack
Digest: sha256:accfc74412af9702c86d370f6289dc9674acc33023369e68f9687b6b4a1b63bd
Status: Image is up to date for public.ecr.aws/heroku-buildpacks/heroku-nodejs-typescript-buildpack@sha256:accfc74412af9702c86d370f6289dc9674acc33023369e68f9687b6b4a1b63bd
Downloading buildpack from image: docker.io/heroku/streaming-http-adapter-buildpack:1.4.0
Pulling image docker.io/heroku/streaming-http-adapter-buildpack:1.4.0
1.4.0: Pulling from heroku/streaming-http-adapter-buildpack
Digest: sha256:74afa72b64c4322a75c75174334ea58d590a5419bf0269543ec73c2ebc184692
Status: Image is up to date for heroku/streaming-http-adapter-buildpack:1.4.0
Downloading buildpack from image: docker.io/heroku/node-function-buildpack:1.5.0
Pulling image docker.io/heroku/node-function-buildpack:1.5.0
1.5.0: Pulling from heroku/node-function-buildpack
Digest: sha256:5ca5d43c012cdd863c3e86289688dba2e7f337a718842b07741f07d1eeccf6a2
Status: Image is up to date for heroku/node-function-buildpack:1.5.0
Downloading buildpack from URI: https://github.com/forcedotcom/nodejs-sf-fx-buildpack/releases/download/v2.0.6/nodejs-sf-fx-buildpack-v2.0.6.tgz
Using cached version of https://github.com/forcedotcom/nodejs-sf-fx-buildpack/releases/download/v2.0.6/nodejs-sf-fx-buildpack-v2.0.6.tgz
Successfully created package test
```

With this change we're now pointing the "regular" function buildpack at docker and the test buildpack at the location on disk:

```
$  pack buildpack package test --config test/meta-buildpacks/nodejs-function/package.toml  -v
Downloading buildpack from URI: file:///Users/rschneeman/Documents/projects/work/cnb/buildpacks-nodejs/test/meta-buildpacks/nodejs-function
Downloading buildpack from URI: file:///Users/rschneeman/Documents/projects/work/cnb/buildpacks-nodejs/buildpacks/nodejs
Downloading buildpack from URI: file:///Users/rschneeman/Documents/projects/work/cnb/buildpacks-nodejs/buildpacks/npm
Downloading buildpack from URI: file:///Users/rschneeman/Documents/projects/work/cnb/buildpacks-nodejs/buildpacks/typescript
Downloading buildpack from image: docker.io/heroku/streaming-http-adapter-buildpack:1.4.0
Pulling image docker.io/heroku/streaming-http-adapter-buildpack:1.4.0
1.4.0: Pulling from heroku/streaming-http-adapter-buildpack
Digest: sha256:74afa72b64c4322a75c75174334ea58d590a5419bf0269543ec73c2ebc184692
Status: Image is up to date for heroku/streaming-http-adapter-buildpack:1.4.0
Downloading buildpack from image: docker.io/heroku/node-function-buildpack:1.5.0
Pulling image docker.io/heroku/node-function-buildpack:1.5.0
1.5.0: Pulling from heroku/node-function-buildpack
Digest: sha256:5ca5d43c012cdd863c3e86289688dba2e7f337a718842b07741f07d1eeccf6a2
Status: Image is up to date for heroku/node-function-buildpack:1.5.0
Downloading buildpack from URI: https://github.com/forcedotcom/nodejs-sf-fx-buildpack/releases/download/v2.0.6/nodejs-sf-fx-buildpack-v2.0.6.tgz
Using cached version of https://github.com/forcedotcom/nodejs-sf-fx-buildpack/releases/download/v2.0.6/nodejs-sf-fx-buildpack-v2.0.6.tgz
ERROR: saving image: buildpack heroku/[email protected] references buildpack heroku/[email protected] which is not present
⛄ 3.0.1 🚀  ~/Documents/projects/work/cnb/buildpacks-nodejs (schneems/node-function-invoker-smoke-test)
$  pack buildpack package test --config test/meta-buildpacks/nodejs-function/package.toml  -v
Downloading buildpack from URI: file:///Users/rschneeman/Documents/projects/work/cnb/buildpacks-nodejs/test/meta-buildpacks/nodejs-function
Downloading buildpack from URI: file:///Users/rschneeman/Documents/projects/work/cnb/buildpacks-nodejs/buildpacks/nodejs
Downloading buildpack from URI: file:///Users/rschneeman/Documents/projects/work/cnb/buildpacks-nodejs/buildpacks/npm
Downloading buildpack from URI: file:///Users/rschneeman/Documents/projects/work/cnb/buildpacks-nodejs/buildpacks/typescript
Downloading buildpack from image: docker.io/heroku/streaming-http-adapter-buildpack:1.4.0
Pulling image docker.io/heroku/streaming-http-adapter-buildpack:1.4.0
1.4.0: Pulling from heroku/streaming-http-adapter-buildpack
Digest: sha256:74afa72b64c4322a75c75174334ea58d590a5419bf0269543ec73c2ebc184692
Status: Image is up to date for heroku/streaming-http-adapter-buildpack:1.4.0
Downloading buildpack from image: docker.io/heroku/node-function-buildpack:1.5.0
Pulling image docker.io/heroku/node-function-buildpack:1.5.0
1.5.0: Pulling from heroku/node-function-buildpack
Digest: sha256:5ca5d43c012cdd863c3e86289688dba2e7f337a718842b07741f07d1eeccf6a2
Status: Image is up to date for heroku/node-function-buildpack:1.5.0
Downloading buildpack from URI: https://github.com/forcedotcom/nodejs-sf-fx-buildpack/releases/download/v2.0.6/nodejs-sf-fx-buildpack-v2.0.6.tgz
Using cached version of https://github.com/forcedotcom/nodejs-sf-fx-buildpack/releases/download/v2.0.6/nodejs-sf-fx-buildpack-v2.0.6.tgz
Successfully created package test
```

Co-authored-by: Manuel Fuchs <[email protected]>
  • Loading branch information
schneems and Malax authored May 5, 2021
1 parent 0640fe1 commit 9d55ab9
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 3 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,4 @@ workflows:
- "buildpacks/typescript"
- "meta-buildpacks/nodejs"
- "test/meta-buildpacks/nodejs"
- "test/meta-buildpacks/nodejs-function"
13 changes: 11 additions & 2 deletions meta-buildpacks/nodejs-function/buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@ type = "MIT"
[[order]]

[[order.group]]
id = "heroku/nodejs"
version = "0.3.3"
id = "heroku/nodejs-engine"
version = "0.7.4"

[[order.group]]
id = "heroku/nodejs-npm"
version = "0.4.4"

[[order.group]]
id = "heroku/nodejs-typescript"
version = "0.2.3"
optional = true

[[order.group]]
id = "heroku/streaming-http-adapter-buildpack"
Expand Down
8 changes: 7 additions & 1 deletion meta-buildpacks/nodejs-function/package.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
uri = "."

[[dependencies]]
uri = "docker://public.ecr.aws/heroku-buildpacks/heroku-nodejs-buildpack@sha256:33925c80a23b9592b4217fc5e8a6deea0fd412b7d2541a11610604cad131e8b4"
uri = "docker://public.ecr.aws/heroku-buildpacks/heroku-nodejs-engine-buildpack@sha256:4fa85f23b1df1138039ec6f5667da48da2af7858767b8840a754c54b39b42ca1"

[[dependencies]]
uri = "docker://public.ecr.aws/heroku-buildpacks/heroku-nodejs-npm-buildpack@sha256:248ce84d07d2b9a11ca2433aee91bec48b2e029aac968e14f57711fe4270159a"

[[dependencies]]
uri = "docker://public.ecr.aws/heroku-buildpacks/heroku-nodejs-typescript-buildpack@sha256:accfc74412af9702c86d370f6289dc9674acc33023369e68f9687b6b4a1b63bd"

[[dependencies]]
uri = "docker://docker.io/heroku/streaming-http-adapter-buildpack:1.4.0"
Expand Down
1 change: 1 addition & 0 deletions test/meta-buildpacks/nodejs-function/build.sh
43 changes: 43 additions & 0 deletions test/meta-buildpacks/nodejs-function/buildpack.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
api = "0.2"

[buildpack]
id = "heroku/nodejs-function"
version = "0.4.0"
name = "Node.js Function"

[[buildpack.licenses]]
type = "MIT"

[[order]]

[[order.group]]
id = "heroku/nodejs-engine"
version = "0.7.4"

[[order.group]]
id = "heroku/nodejs-npm"
version = "0.4.4"

[[order.group]]
id = "heroku/nodejs-typescript"
version = "0.2.3"
optional = true

[[order.group]]
id = "heroku/streaming-http-adapter-buildpack"
version = "1.4.0"

[[order.group]]
id = "heroku/node-function-buildpack"
version = "1.5.0"

[[order.group]]
id = "salesforce/nodejs-fn"
version = "2.0.6"

[metadata]

[metadata.release]

[metadata.release.docker]
repository = "public.ecr.aws/heroku-buildpacks/heroku-nodejs-function-buildpack"
20 changes: 20 additions & 0 deletions test/meta-buildpacks/nodejs-function/package.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[buildpack]
uri = "."

[[dependencies]]
uri = "../../../buildpacks/nodejs"

[[dependencies]]
uri = "../../../buildpacks/npm"

[[dependencies]]
uri = "../../../buildpacks/typescript"

[[dependencies]]
uri = "docker://docker.io/heroku/streaming-http-adapter-buildpack:1.4.0"

[[dependencies]]
uri = "docker://docker.io/heroku/node-function-buildpack:1.5.0"

[[dependencies]]
uri = "https://github.com/forcedotcom/nodejs-sf-fx-buildpack/releases/download/v2.0.6/nodejs-sf-fx-buildpack-v2.0.6.tgz"

0 comments on commit 9d55ab9

Please sign in to comment.