Skip to content

Commit

Permalink
use new JS hello world app for cnb integration
Browse files Browse the repository at this point in the history
Co-authored-by: Pavel Busko <pavel.busko@sap.com>
  • Loading branch information
modulo11 and pbusko committed Sep 19, 2024
1 parent 298ac3c commit 2ae190c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
12 changes: 12 additions & 0 deletions integration/assets/js-hello/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const http = require('http');

const server = http.createServer((_req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});

const port = process.env.PORT;
server.listen(port, "0.0.0.0", () => {
console.log(`Server running at http://0.0.0.0:${port}/`);
});
8 changes: 8 additions & 0 deletions integration/assets/js-hello/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "js-hello",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "node ./index.js"
}
}
5 changes: 5 additions & 0 deletions integration/helpers/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ func WithMultiBuildpackApp(f func(dir string)) {
f("../../assets/go_calls_ruby")
}

// WithJSHelloWorld creates a simple JS Hello World HTTP application to use with the CF push command.
func WithJSHelloWorld(f func(dir string)) {
f("../../assets/js-hello")
}

// WithProcfileApp creates an application to use with your CLI command
// that contains Procfile defining web and worker processes.
func WithProcfileApp(f func(dir string)) {
Expand Down
6 changes: 3 additions & 3 deletions integration/v7/isolated/app_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,14 +409,14 @@ applications:

When("the app is a CNB app", func() {
BeforeEach(func() {
helpers.WithProcfileApp(func(appDir string) {
Eventually(helpers.CF("push", appName, "-p", appDir, "--lifecycle", "cnb", "-b", "docker://gcr.io/paketo-buildpacks/ruby:latest")).Should(Exit())
helpers.WithJSHelloWorld(func(appDir string) {
Eventually(helpers.CF("push", appName, "-p", appDir, "--lifecycle", "cnb", "-b", "docker://gcr.io/paketo-buildpacks/nodejs:latest")).Should(Exit())
})
})

It("displays the app buildpacks", func() {
session := helpers.CF("app", appName)
Eventually(session).Should(Say(`paketo-buildpacks\/ruby`))
Eventually(session).Should(Say(`paketo-buildpacks\/nodejs`))
Eventually(session).Should(Exit(0))
})
})
Expand Down

0 comments on commit 2ae190c

Please sign in to comment.