Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ include_app_syslog_tcp
* `include_app_syslog_tcp`: Flag to include the app syslog drain over TCP test group.
* `include_apps`: Flag to include the apps test group.
* `readiness_health_checks_enabled`: Defaults to `true`. Set to false if you are using an environment without readiness health checks.
* `include_cnb`: Flag to include tests related to building apps using Cloud Native Buildpacks. Diego must be deployed and the CC API diego_cnb feature flag must be enabled for these tests to pass. The CF CLI version must be at least v8.9.0.
* `include_cnb`: Flag to include tests related to building apps using Cloud Native Buildpacks. Diego must be deployed and the CC API diego_cnb feature flag must be enabled for these tests to pass. The CF CLI version must be at least v8.14.0.
* `include_container_networking`: Flag to include tests related to container networking.
* `credhub_mode`: Valid values are `assisted` or `non-assisted`. [See below](#credhub-modes).
* `credhub_location`: Location of CredHub instance; default is `https://credhub.service.cf.internal:8844`
Expand Down
Binary file added assets/cnb-node-buildpack/nodejs-7.6.2.cnb
Binary file not shown.
45 changes: 35 additions & 10 deletions cnb/cnb_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/cloudfoundry/cf-acceptance-tests/helpers/random_name"
"github.com/cloudfoundry/cf-test-helpers/v2/cf"
"github.com/cloudfoundry/cf-test-helpers/v2/helpers"
"github.com/cloudfoundry/cf-test-helpers/v2/workflowhelpers"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -43,17 +44,41 @@ var _ = CNBDescribe("CloudNativeBuildpacks lifecycle", func() {
})
})

Describe("pushing Node.js application with CNB lifecycle and no buildpacks", func() {
It("fails", func() {
Skip("System buildpacks are supported in latest CAPI version")
push := cf.Cf("push",
appName,
"-p", assets.NewAssets().CNBNode,
"-f", filepath.Join(assets.NewAssets().CNBNode, "manifest.yml"),
).Wait(Config.CfPushTimeoutDuration())
Describe("creating system CNB buildpacks", func() {
var buildpackName string

BeforeEach(func() {
buildpackName = random_name.CATSRandomName("CNB-BUILDPACK")
})

AfterEach(func() {
workflowhelpers.AsUser(TestSetup.AdminUserContext(), Config.DefaultTimeoutDuration(), func() {
Expect(cf.Cf("delete-buildpack", buildpackName, "-f").Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
})
})

Describe("uploading a .cnb extension cnb", func() {
It("makes the app reachable by its bound route", func() {
workflowhelpers.AsUser(TestSetup.AdminUserContext(), Config.DefaultTimeoutDuration(), func() {
Expect(cf.Cf("create-buildpack",
buildpackName,
assets.NewAssets().CNBNodeBuildpack,
"1",
"--lifecycle", "cnb",
).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
})

Expect(cf.Cf("push",
appName,
"-p", assets.NewAssets().CNBNode,
"-b", buildpackName,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just wondering wether we need to specify the buildpack name or let CF figure it out. In this way we could also test the auto detection with system buildpacks. Or does this makes the test flaky?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it would make the test flakier than it might otherwise be, but it would certainly make it take longer to run. Most of the tests in the buildpack detect suite rely on auto-detection so I don't think we need to also test it here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my current understanding, enabling the –b option does not appear to affect execution time significantly, as the detect command is executed in both cases with an order containing a single buildpack (assuming my interpretation of this code section is accurate). Additionally, there seems to be a minor distinction between using the –b option and not, as indicated in this pull request. However, since we already have a comprehensive buildpack test suite that will be executed against CNBs, I also think that it is not necessary to add further tests about auto detection here.

Thank you for the thoughtful discussion!

"-f", filepath.Join(assets.NewAssets().CNBNode, "manifest.yml"),
).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))

Expect(push).To(Exit(1))
Expect(combineOutput(push.Out, push.Err)).To(Say("Buildpack\\(s\\) must be specified when using Cloud Native Buildpacks"))
Eventually(func() string {
return helpers.CurlAppRoot(Config, appName)
}).Should(ContainSubstring("Hello from a node app!"))
})
})
})
})
Expand Down
2 changes: 2 additions & 0 deletions helpers/assets/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ type Assets struct {
AspClassic string
Catnip string
CatnipSrc string
CNBNodeBuildpack string
CredHubEnabledApp string
CredHubServiceBroker string
Dora string
Expand Down Expand Up @@ -51,6 +52,7 @@ func NewAssets() Assets {
AspClassic: "assets/asp-classic",
Catnip: "assets/catnip/bin",
CatnipSrc: "assets/catnip",
CNBNodeBuildpack: "assets/cnb-node-buildpack/nodejs-7.6.2.cnb",
CredHubEnabledApp: "assets/credhub-enabled-app/credhub-enabled-app.jar",
CredHubServiceBroker: "assets/credhub-service-broker",
Dora: "assets/dora",
Expand Down
Loading