-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Forest Eckhardt <[email protected]>
- Loading branch information
1 parent
74e8b9c
commit e49f2e5
Showing
9 changed files
with
1,156 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package smoke_test | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/paketo-buildpacks/occam" | ||
"github.com/sclevine/spec" | ||
|
||
. "github.com/onsi/gomega" | ||
. "github.com/paketo-buildpacks/occam/matchers" | ||
) | ||
|
||
func testNodejs(t *testing.T, context spec.G, it spec.S) { | ||
var ( | ||
Expect = NewWithT(t).Expect | ||
Eventually = NewWithT(t).Eventually | ||
|
||
pack occam.Pack | ||
docker occam.Docker | ||
) | ||
|
||
it.Before(func() { | ||
pack = occam.NewPack().WithVerbose().WithNoColor() | ||
docker = occam.NewDocker() | ||
}) | ||
|
||
context("detects a Nodejs app", func() { | ||
var ( | ||
image occam.Image | ||
container occam.Container | ||
|
||
name string | ||
source string | ||
) | ||
|
||
it.Before(func() { | ||
var err error | ||
name, err = occam.RandomName() | ||
Expect(err).NotTo(HaveOccurred()) | ||
}) | ||
|
||
it.After(func() { | ||
Expect(docker.Container.Remove.Execute(container.ID)).To(Succeed()) | ||
Expect(docker.Volume.Remove.Execute(occam.CacheVolumeNames(name))).To(Succeed()) | ||
Expect(docker.Image.Remove.Execute(image.ID)).To(Succeed()) | ||
Expect(os.RemoveAll(source)).To(Succeed()) | ||
}) | ||
|
||
it("builds successfully", func() { | ||
var err error | ||
source, err = occam.Source(filepath.Join("testdata", "nodejs")) | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
var logs fmt.Stringer | ||
image, logs, err = pack.Build. | ||
WithPullPolicy("never"). | ||
WithBuilder(Builder). | ||
Execute(name, source) | ||
Expect(err).ToNot(HaveOccurred(), logs.String) | ||
|
||
container, err = docker.Container.Run. | ||
WithEnv(map[string]string{"PORT": "8080"}). | ||
WithPublish("8080"). | ||
Execute(image.ID) | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
Eventually(container).Should(BeAvailable()) | ||
|
||
Expect(logs).To(ContainLines(ContainSubstring("Paketo Node Engine Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Paketo NPM Install Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Paketo NPM Start Buildpack"))) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Node.js Sample App using NPM | ||
|
||
## Building | ||
|
||
`pack build npm-sample --buildpack gcr.io/paketo-buildpacks/nodejs` | ||
|
||
## Running | ||
|
||
`docker run --interactive --tty --publish 8080:8080 npm-sample` | ||
|
||
## Viewing | ||
|
||
`curl http://localhost:8080` |
Oops, something went wrong.