Skip to content

Commit 3d41a50

Browse files
committed
Add test for uploading system CNB
* includes pushing an app with it
1 parent 134dcfc commit 3d41a50

File tree

4 files changed

+38
-11
lines changed

4 files changed

+38
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ include_app_syslog_tcp
111111
* `include_app_syslog_tcp`: Flag to include the app syslog drain over TCP test group.
112112
* `include_apps`: Flag to include the apps test group.
113113
* `readiness_health_checks_enabled`: Defaults to `true`. Set to false if you are using an environment without readiness health checks.
114-
* `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.
114+
* `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.
115115
* `include_container_networking`: Flag to include tests related to container networking.
116116
* `credhub_mode`: Valid values are `assisted` or `non-assisted`. [See below](#credhub-modes).
117117
* `credhub_location`: Location of CredHub instance; default is `https://credhub.service.cf.internal:8844`
67.2 MB
Binary file not shown.

cnb/cnb_lifecycle.go

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/cloudfoundry/cf-acceptance-tests/helpers/random_name"
1010
"github.com/cloudfoundry/cf-test-helpers/v2/cf"
1111
"github.com/cloudfoundry/cf-test-helpers/v2/helpers"
12+
"github.com/cloudfoundry/cf-test-helpers/v2/workflowhelpers"
1213

1314
. "github.com/onsi/ginkgo/v2"
1415
. "github.com/onsi/gomega"
@@ -43,17 +44,41 @@ var _ = CNBDescribe("CloudNativeBuildpacks lifecycle", func() {
4344
})
4445
})
4546

46-
Describe("pushing Node.js application with CNB lifecycle and no buildpacks", func() {
47-
It("fails", func() {
48-
Skip("System buildpacks are supported in latest CAPI version")
49-
push := cf.Cf("push",
50-
appName,
51-
"-p", assets.NewAssets().CNBNode,
52-
"-f", filepath.Join(assets.NewAssets().CNBNode, "manifest.yml"),
53-
).Wait(Config.CfPushTimeoutDuration())
47+
Describe("creating system CNB buildpacks", func() {
48+
var buildpackName string
49+
50+
BeforeEach(func() {
51+
buildpackName = random_name.CATSRandomName("CNB-BUILDPACK")
52+
})
53+
54+
AfterEach(func() {
55+
workflowhelpers.AsUser(TestSetup.AdminUserContext(), Config.DefaultTimeoutDuration(), func() {
56+
Expect(cf.Cf("delete-buildpack", buildpackName, "-f").Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
57+
})
58+
})
59+
60+
Describe("uploading a .cnb extension cnb", func() {
61+
It("makes the app reachable by its bound route", func() {
62+
workflowhelpers.AsUser(TestSetup.AdminUserContext(), Config.DefaultTimeoutDuration(), func() {
63+
Expect(cf.Cf("create-buildpack",
64+
buildpackName,
65+
assets.NewAssets().CNBNodeBuildpack,
66+
"1",
67+
"--lifecycle", "cnb",
68+
).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
69+
})
70+
71+
Expect(cf.Cf("push",
72+
appName,
73+
"-p", assets.NewAssets().CNBNode,
74+
"-b", buildpackName,
75+
"-f", filepath.Join(assets.NewAssets().CNBNode, "manifest.yml"),
76+
).Wait(Config.CfPushTimeoutDuration())).To(Exit(0))
5477

55-
Expect(push).To(Exit(1))
56-
Expect(combineOutput(push.Out, push.Err)).To(Say("Buildpack\\(s\\) must be specified when using Cloud Native Buildpacks"))
78+
Eventually(func() string {
79+
return helpers.CurlAppRoot(Config, appName)
80+
}).Should(ContainSubstring("Hello from a node app!"))
81+
})
5782
})
5883
})
5984
})

helpers/assets/assets.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ type Assets struct {
44
AspClassic string
55
Catnip string
66
CatnipSrc string
7+
CNBNodeBuildpack string
78
CredHubEnabledApp string
89
CredHubServiceBroker string
910
Dora string
@@ -51,6 +52,7 @@ func NewAssets() Assets {
5152
AspClassic: "assets/asp-classic",
5253
Catnip: "assets/catnip/bin",
5354
CatnipSrc: "assets/catnip",
55+
CNBNodeBuildpack: "assets/cnb-node-buildpack/nodejs-7.6.2.cnb",
5456
CredHubEnabledApp: "assets/credhub-enabled-app/credhub-enabled-app.jar",
5557
CredHubServiceBroker: "assets/credhub-service-broker",
5658
Dora: "assets/dora",

0 commit comments

Comments
 (0)