diff --git a/README.md b/README.md index 446ae096f..8a06c6a24 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,7 @@ include_app_syslog_tcp * `volume_service_name`: The name of the volume service provided by the volume service broker. * `volume_service_plan_name`: The name of the plan of the service provided by the volume service broker. * `volume_service_create_config`: The JSON configuration that is used when volume service is created. +* `volume_service_bind_config`: The JSON configuration for the volume service binding configuration. #### Buildpack Names Many tests specify a buildpack when pushing an app, so that on diego the app staging process completes in less time. The default names for the buildpacks are as follows; if you have buildpacks with different names, you can override them by setting different names: diff --git a/cats_suite_helpers/cats_suite_helpers.go b/cats_suite_helpers/cats_suite_helpers.go index 44362631c..38774814a 100644 --- a/cats_suite_helpers/cats_suite_helpers.go +++ b/cats_suite_helpers/cats_suite_helpers.go @@ -395,9 +395,6 @@ func VolumeServicesDescribe(description string, callback func()) bool { if !Config.GetIncludeVolumeServices() { Skip(skip_messages.SkipVolumeServicesMessage) } - if Config.GetIncludeDocker() { - Skip(skip_messages.SkipVolumeServicesDockerEnabledMessage) - } }) Describe(description, callback) }) diff --git a/helpers/config/config.go b/helpers/config/config.go index 7e3f003bc..2a1547df3 100644 --- a/helpers/config/config.go +++ b/helpers/config/config.go @@ -94,6 +94,7 @@ type CatsConfig interface { GetVolumeServiceName() string GetVolumeServicePlanName() string GetVolumeServiceCreateConfig() string + GetVolumeServiceBindConfig() string GetReporterConfig() reporterConfig diff --git a/helpers/config/config_struct.go b/helpers/config/config_struct.go index 4934cb1bb..2f2bfd6d1 100644 --- a/helpers/config/config_struct.go +++ b/helpers/config/config_struct.go @@ -68,6 +68,7 @@ type config struct { VolumeServiceName *string `json:"volume_service_name"` VolumeServicePlanName *string `json:"volume_service_plan_name"` VolumeServiceCreateConfig *string `json:"volume_service_create_config"` + VolumeServiceBindConfig *string `json:"volume_service_bind_config"` IncludeAppSyslogTCP *bool `json:"include_app_syslog_tcp"` IncludeApps *bool `json:"include_apps"` @@ -204,6 +205,7 @@ func getDefaults() config { defaults.VolumeServiceName = ptrToString("") defaults.VolumeServicePlanName = ptrToString("") defaults.VolumeServiceCreateConfig = ptrToString("") + defaults.VolumeServiceBindConfig = ptrToString("") defaults.ReporterConfig = &reporterConfig{} @@ -1135,6 +1137,10 @@ func (c *config) GetVolumeServiceCreateConfig() string { return *c.VolumeServiceCreateConfig } +func (c *config) GetVolumeServiceBindConfig() string { + return *c.VolumeServiceBindConfig +} + func (c *config) GetAdminClient() string { return "" } diff --git a/volume_services/volume_services.go b/volume_services/volume_services.go index 8de003aa8..a0a518bcd 100644 --- a/volume_services/volume_services.go +++ b/volume_services/volume_services.go @@ -26,7 +26,6 @@ var _ = VolumeServicesDescribe("Volume Services", func() { poraAsset = assets.NewAssets().Pora routerGroupGuid string reservablePorts string - nfsPort = "2049" tcpDomain string ) @@ -36,10 +35,7 @@ var _ = VolumeServicesDescribe("Volume Services", func() { appName = random_name.CATSRandomName("APP") workflowhelpers.AsUser(TestSetup.AdminUserContext(), TestSetup.ShortTimeout(), func() { - session := cf.Cf("enable-feature-flag", "diego_docker").Wait() - Expect(session).To(Exit(0), "cannot enable diego_docker feature flag") - - session = cf.Cf("curl", "/routing/v1/router_groups").Wait() + session := cf.Cf("curl", "/routing/v1/router_groups").Wait() Expect(session).To(Exit(0), "cannot retrieve current router groups") routerGroupGuid, reservablePorts = routerGroupIdAndPorts(session.Out.Contents()) @@ -48,7 +44,7 @@ var _ = VolumeServicesDescribe("Volume Services", func() { session = cf.Cf("curl", fmt.Sprintf("/routing/v1/router_groups/%s", routerGroupGuid), "-X", "PUT", "-d", payload).Wait() Expect(session).To(Exit(0), "cannot update tcp router group to allow nfs traffic") - tcpDomain = fmt.Sprintf("tcp.%s", Config.GetAppsDomain()) + tcpDomain = Config.GetTCPDomain() session = cf.Cf("create-shared-domain", tcpDomain, "--router-group", "default-tcp").Wait() Eventually(session).Should(Exit()) @@ -61,31 +57,6 @@ var _ = VolumeServicesDescribe("Volume Services", func() { }) - By("pushing an nfs server") - Expect(cf.Cf("push", "nfs", "--docker-image", "cfpersi/nfs-cats", "--health-check-type", "process", "--no-start"). - Wait(Config.CfPushTimeoutDuration())).To(Exit(0), "cannot push the nfs server app") - - session := cf.Cf("create-route", tcpDomain, "--port", nfsPort).Wait() - Expect(session).To(Exit(0), "cannot create a tcp route for the nfs server app") - - nfsGuid := GuidForAppName("nfs") - workflowhelpers.AsUser(TestSetup.AdminUserContext(), TestSetup.ShortTimeout(), func() { - session := cf.Cf("curl", "/v3/routes").Wait() - Expect(session).To(Exit(0), "cannot retrieve current routes") - - routes := &Routes{} - err := json.Unmarshal(session.Out.Contents(), routes) - Expect(err).NotTo(HaveOccurred()) - - routeId := nfsRouteGuid(routes) - - session = cf.Cf("curl", fmt.Sprintf("/v3/routes/%s/destinations", routeId), "-X", "POST", "-d", fmt.Sprintf(`{"destinations": [{"app": {"guid": "%s"}, "port": %s}]}`, nfsGuid, nfsPort)).Wait() - Expect(session).To(Exit(0), "cannot create a tcp route mapping to the nfs server app") - }) - - session = cf.Cf("start", "nfs").Wait(Config.CfPushTimeoutDuration()) - Expect(session).To(Exit(0), "cannot start the nfs server app") - workflowhelpers.AsUser(TestSetup.AdminUserContext(), TestSetup.ShortTimeout(), func() { session := cf.Cf("enable-service-access", serviceName, "-o", TestSetup.RegularUserContext().Org).Wait() Expect(session).To(Exit(0), "cannot enable nfs service access") @@ -103,24 +74,24 @@ var _ = VolumeServicesDescribe("Volume Services", func() { By("creating a service") var createServiceSession *Session - if Config.GetVolumeServiceCreateConfig() != "" { - createServiceSession = cf.Cf("create-service", serviceName, Config.GetVolumeServicePlanName(), serviceInstanceName, "-c", Config.GetVolumeServiceCreateConfig()) - } else { + if Config.GetVolumeServiceCreateConfig() == "" { createServiceSession = cf.Cf("create-service", serviceName, Config.GetVolumeServicePlanName(), serviceInstanceName, "-c", fmt.Sprintf(`{"share": "%s/"}`, tcpDomain)) + } else { + createServiceSession = cf.Cf("create-service", serviceName, Config.GetVolumeServicePlanName(), serviceInstanceName, "-c", Config.GetVolumeServiceCreateConfig()) } Expect(createServiceSession.Wait(TestSetup.ShortTimeout())).To(Exit(0), "cannot create an nfs service instance") By("binding the service") var bindSession *Session - if Config.GetVolumeServiceCreateConfig() != "" { - bindSession = cf.Cf("bind-service", appName, serviceInstanceName) + if Config.GetVolumeServiceBindConfig() == "" { + bindSession = cf.Cf("bind-service", appName, serviceInstanceName, "-c", `{"uid": "1000", "gid": "1000"}`) } else { - bindSession = cf.Cf("bind-service", appName, serviceInstanceName, "-c", `{"uid": "2000", "gid": "2000"}`) + bindSession = cf.Cf("bind-service", appName, serviceInstanceName, "-c", Config.GetVolumeServiceBindConfig()) } Expect(bindSession.Wait(TestSetup.ShortTimeout())).To(Exit(0), "cannot bind the nfs service instance to the test app") By("starting the app") - session = cf.Cf("start", appName).Wait(Config.CfPushTimeoutDuration()) + session := cf.Cf("start", appName).Wait(Config.CfPushTimeoutDuration()) Eventually(session).Should(Exit()) if session.ExitCode() != 0 { cf.Cf("logs", appName, "--recent") @@ -133,9 +104,6 @@ var _ = VolumeServicesDescribe("Volume Services", func() { payload := fmt.Sprintf(`{ "reservable_ports":"%s", "name":"default-tcp", "type": "tcp"}`, reservablePorts) session := cf.Cf("curl", fmt.Sprintf("/routing/v1/router_groups/%s", routerGroupGuid), "-X", "PUT", "-d", payload).Wait() Expect(session).To(Exit(0), "cannot retrieve current router groups") - - session = cf.Cf("disable-feature-flag", "diego_docker").Wait() - Expect(session).To(Exit(0), "cannot disable diego_docker feature flag") }) }) @@ -144,16 +112,6 @@ var _ = VolumeServicesDescribe("Volume Services", func() { }) }) -func nfsRouteGuid(routes *Routes) string { - for _, resource := range routes.Resources { - if resource.Port != 0 && resource.Port == 2049 { - return resource.GUID - } - } - Fail("Unable to find a valid tcp route for port 2049") - return "" -} - func routerGroupIdAndPorts(routerGroupOutput []byte) (guid, ports string) { routerGroups := &[]RouterGroup{} err := json.Unmarshal(routerGroupOutput, routerGroups)