-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add order group for poetry - dependency-only. (#430)
- Loading branch information
1 parent
841cd5c
commit a3cf2d2
Showing
7 changed files
with
357 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package integration_test | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
"net/http" | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/paketo-buildpacks/occam" | ||
"github.com/sclevine/spec" | ||
|
||
. "github.com/onsi/gomega" | ||
. "github.com/paketo-buildpacks/occam/matchers" | ||
) | ||
|
||
func testPoetryDepOnly(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() | ||
docker = occam.NewDocker() | ||
}) | ||
|
||
context("when building an app with poetry dependency management", 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.Image.Remove.Execute(image.ID)).To(Succeed()) | ||
Expect(docker.Volume.Remove.Execute(occam.CacheVolumeNames(name))).To(Succeed()) | ||
Expect(os.RemoveAll(source)).To(Succeed()) | ||
}) | ||
|
||
it("creates a working OCI image with a start command", func() { | ||
var err error | ||
source, err = occam.Source(filepath.Join("testdata", "poetry-dep-only")) | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
var logs fmt.Stringer | ||
image, logs, err = pack.WithNoColor().WithVerbose().Build. | ||
WithBuildpacks(pythonBuildpack). | ||
WithPullPolicy("never"). | ||
WithEnv(map[string]string{ | ||
"BPE_SOME_VARIABLE": "some-value", | ||
"BP_IMAGE_LABELS": "some-label=some-value", | ||
"BP_LIVE_RELOAD_ENABLED": "true", | ||
}). | ||
Execute(name, source) | ||
Expect(err).NotTo(HaveOccurred(), logs.String()) | ||
|
||
container, err = docker.Container.Run. | ||
WithEnv(map[string]string{"PORT": "8080"}). | ||
WithPublish("8080"). | ||
WithPublishAll(). | ||
Execute(image.ID) | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
Eventually(container).Should(BeAvailable()) | ||
|
||
response, err := http.Get(fmt.Sprintf("http://localhost:%s", container.HostPort("8080"))) | ||
Expect(err).NotTo(HaveOccurred()) | ||
defer response.Body.Close() | ||
|
||
Expect(response.StatusCode).To(Equal(http.StatusOK)) | ||
|
||
content, err := io.ReadAll(response.Body) | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(string(content)).To(ContainSubstring("Hello, World!")) | ||
|
||
Expect(logs).To(ContainLines(ContainSubstring("CA Certificates Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Watchexec Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("CPython Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Pip Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Poetry Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Poetry Install Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Python Start Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Procfile Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Environment Variables Buildpack"))) | ||
Expect(logs).To(ContainLines(ContainSubstring("Image Labels Buildpack"))) | ||
|
||
Expect(image.Buildpacks[8].Key).To(Equal("paketo-buildpacks/environment-variables")) | ||
Expect(image.Buildpacks[8].Layers["environment-variables"].Metadata["variables"]).To(Equal(map[string]interface{}{"SOME_VARIABLE": "some-value"})) | ||
Expect(image.Labels["some-label"]).To(Equal("some-value")) | ||
}) | ||
}) | ||
} |
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 @@ | ||
web: gunicorn server:app |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.