-
Notifications
You must be signed in to change notification settings - Fork 175
Expand file tree
/
Copy pathfile_based_service_bindings.go
More file actions
73 lines (62 loc) · 2.96 KB
/
file_based_service_bindings.go
File metadata and controls
73 lines (62 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package file_based_service_bindings
import (
. "github.com/cloudfoundry/cf-acceptance-tests/cats_suite_helpers"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/app_helpers"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/random_name"
"github.com/cloudfoundry/cf-acceptance-tests/helpers/services"
"github.com/cloudfoundry/cf-test-helpers/v2/cf"
"github.com/cloudfoundry/cf-test-helpers/v2/generator"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
)
var _ = FileBasedServiceBindingsDescribe("Enabling file based service binding for a buildpack app", BuildpackLifecycle, func() {
callback(&BuildpackLifecycles{})
})
var _ = FileBasedServiceBindingsDescribe("Enabling file based service binding for a CNB app", CNBLifecycle, func() {
callback(&CNBLifecycles{})
})
var _ = FileBasedServiceBindingsDescribe("Enabling file based service binding for a Docker app", DockerLifecycle, func() {
callback(&DockerLifecycles{})
})
var callback = func(lifeCycle LifeCycle) {
var appName, serviceName string
BeforeEach(func() {
appName = random_name.CATSRandomName("APP")
serviceName = generator.PrefixedRandomName("cats", "svin") // uppercase characters are not valid
})
Context("When the file-based-vcap-services feature is enabled", func() {
Context("Via API call", func() {
It("It should store the VCAP_SERVICES binding information in a file in the VCAP_SERVICES_FILE_PATH", func() {
appGuid, serviceGuid := Prepare(appName, serviceName, "file-based-vcap-services", lifeCycle)
services.ValidateFileBasedVcapServices(appName, serviceName, appGuid, serviceGuid)
})
})
Context("Via manifest", func() {
It("It should store the VCAP_SERVICES binding information in a file in the VCAP_SERVICES_FILE_PATH", func() {
appGuid, serviceGuid := PrepareWithManifest(appName, serviceName, "file-based-vcap-services", lifeCycle)
services.ValidateFileBasedVcapServices(appName, serviceName, appGuid, serviceGuid)
})
})
})
Context("When the service-binding-k8s feature is enabled", func() {
Context("Via API call", func() {
It("It should store the binding information in files under the SERVICE_BINDING_ROOT path", func() {
appGuid, serviceGuid := Prepare(appName, serviceName, "service-binding-k8s", lifeCycle)
services.ValidateServiceBindingK8s(appName, serviceName, appGuid, serviceGuid)
})
})
Context("Via manifest", func() {
It("It should store the binding information in files under the SERVICE_BINDING_ROOT path", func() {
appGuid, serviceGuid := PrepareWithManifest(appName, serviceName, "service-binding-k8s", lifeCycle)
services.ValidateServiceBindingK8s(appName, serviceName, appGuid, serviceGuid)
})
})
})
AfterEach(func() {
app_helpers.AppReport(appName)
Eventually(cf.Cf("unbind-service", appName, serviceName).Wait()).Should(Exit(0))
Eventually(cf.Cf("delete", appName, "-f")).Should(Exit(0))
Eventually(cf.Cf("delete-service", serviceName, "-f").Wait()).Should(Exit(0))
})
}