func (b ServiceBroker) ToJSON() string { bytes, err := ioutil.ReadFile(assets.NewAssets().ServiceBroker + "/cats.json") Expect(err).To(BeNil()) replacer := strings.NewReplacer( "<fake-service>", b.Service.Name, "<fake-service-guid>", b.Service.ID, "<dashboard-client-key>", b.Service.DashboardClient.Key, "<sso-test>", b.Service.DashboardClient.ID, "<sso-secret>", b.Service.DashboardClient.Secret, "<sso-redirect-uri>", b.Service.DashboardClient.RedirectUri, "<fake-plan>", b.SyncPlans[0].Name, "<fake-plan-guid>", b.SyncPlans[0].ID, "<fake-plan-2>", b.SyncPlans[1].Name, "<fake-plan-2-guid>", b.SyncPlans[1].ID, "<fake-async-plan>", b.AsyncPlans[0].Name, "<fake-async-plan-guid>", b.AsyncPlans[0].ID, "<fake-async-plan-2>", b.AsyncPlans[1].Name, "<fake-async-plan-2-guid>", b.AsyncPlans[1].ID, "<fake-sso-plan>", b.SsoPlans[0].Name, "<fake-sso-plan-guid>", b.SsoPlans[0].ID, "<sso-plan-client-id>", b.SsoPlans[0].DashboardClient.ID, "<sso-plan-secret>", b.SsoPlans[0].DashboardClient.Secret, ) return replacer.Replace(string(bytes)) }
func createDummyBuildpack() string { buildpack := random_name.CATSRandomName("BPK") buildpackZip := assets.NewAssets().SecurityGroupBuildpack workflowhelpers.AsUser(TestSetup.AdminUserContext(), Config.DefaultTimeoutDuration(), func() { Expect(cf.Cf("create-buildpack", buildpack, buildpackZip, "999").Wait(Config.DefaultTimeoutDuration())).To(Exit(0)) }) return buildpack }
func pushApp(appName, buildpack string) { Expect(cf.Cf("push", appName, "--no-start", "-b", buildpack, "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().Dora, "-d", Config.GetAppsDomain()).Wait(Config.CfPushTimeoutDuration())).To(Exit(0)) app_helpers.SetBackend(appName) }
func createServiceBroker(brokerName, brokerAppName, serviceName string) { serviceBrokerAsset := assets.NewAssets().ServiceBroker PushApp(brokerAppName, serviceBrokerAsset, Config.GetRubyBuildpackName(), Config.GetAppsDomain(), Config.CfPushTimeoutDuration(), DEFAULT_MEMORY_LIMIT) initiateBrokerConfig(serviceName, brokerAppName) brokerUrl := helpers.AppUri(brokerAppName, "", Config) workflowhelpers.AsUser(TestSetup.AdminUserContext(), TestSetup.ShortTimeout(), func() { session := cf.Cf("create-service-broker", brokerName, "user", "password", brokerUrl) Expect(session.Wait(Config.DefaultTimeoutDuration())).To(Exit(0)) session = cf.Cf("enable-service-access", serviceName) Expect(session.Wait(Config.DefaultTimeoutDuration())).To(Exit(0)) }) }
func createServiceBroker() (string, string, string) { serviceBrokerAsset := assets.NewAssets().ServiceBroker serviceBrokerAppName := PushApp(serviceBrokerAsset, config.RubyBuildpackName) serviceName := initiateBrokerConfig(serviceBrokerAppName) brokerName := generator.PrefixedRandomName("RATS-BROKER-") brokerUrl := helpers.AppUri(serviceBrokerAppName, "") config = helpers.LoadConfig() context := helpers.NewContext(config) cf.AsUser(context.AdminUserContext(), context.ShortTimeout(), func() { session := cf.Cf("create-service-broker", brokerName, "user", "password", brokerUrl) Expect(session.Wait(DEFAULT_TIMEOUT)).To(Exit(0)) session = cf.Cf("enable-service-access", serviceName) Expect(session.Wait(DEFAULT_TIMEOUT)).To(Exit(0)) }) return brokerName, serviceBrokerAppName, serviceName }
} type AppsResponse struct { Resources []AppResource `json:"resources"` } Describe("Staging", func() { var appName string BeforeEach(func() { appName = generator.PrefixedRandomName("CATS-APP-") }) Describe("without a procfile", func() { BeforeEach(func() { Expect(cf.Cf("push", appName, "-p", assets.NewAssets().Node, "-c", "node server.js --cool-arg", "-d", config.AppsDomain).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) }) AfterEach(func() { Expect(cf.Cf("delete", appName, "-f").Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) }) It(diegoUnsupportedTag+"detects the use of the start command supplied on the command line", func() { var appsResponse AppsResponse cfResponse := cf.Cf("curl", fmt.Sprintf("/v2/apps?q=name:%s", appName)).Wait(DEFAULT_TIMEOUT).Out.Contents() json.Unmarshal(cfResponse, &appsResponse) Expect(appsResponse.Resources[0].Entity.DetectedStartCommand).To(Equal("node server.js --cool-arg")) }) })
"github.com/cloudfoundry-incubator/cf-test-helpers/cf" "github.com/cloudfoundry-incubator/cf-test-helpers/generator" "github.com/cloudfoundry-incubator/cf-test-helpers/helpers" "github.com/cloudfoundry/cf-acceptance-tests/helpers/assets" ) var _ = Describe("Copy app bits", func() { var golangAppName string var helloWorldAppName string BeforeEach(func() { golangAppName = generator.PrefixedRandomName("CATS-APP-") helloWorldAppName = generator.PrefixedRandomName("CATS-APP-") Expect(cf.Cf("push", golangAppName, "-p", assets.NewAssets().Golang, "--no-start").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) Expect(cf.Cf("push", helloWorldAppName, "-p", assets.NewAssets().HelloWorld, "--no-start").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) }) AfterEach(func() { Expect(cf.Cf("delete", golangAppName, "-f").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) Expect(cf.Cf("delete", helloWorldAppName, "-f").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) }) It("Copies over the package from the source app to the destination app", func() { Expect(cf.Cf("copy-source", helloWorldAppName, golangAppName).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) Eventually(func() string { return helpers.CurlAppRoot(golangAppName) }, DEFAULT_TIMEOUT).Should(ContainSubstring("Hello, world!")) })
} } type StatsResponse map[string]Stat type DoraCurlResponse struct { Stdout string Stderr string ReturnCode int `json:"return_code"` } var serverAppName, securityGroupName, privateHost string var privatePort int BeforeEach(func() { serverAppName = generator.PrefixedRandomName("CATS-APP-") Expect(cf.Cf("push", serverAppName, "-m", "128M", "-p", assets.NewAssets().Dora, "-d", config.AppsDomain).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) // gather app url var appsResponse AppsResponse cfResponse := cf.Cf("curl", fmt.Sprintf("/v2/apps?q=name:%s", serverAppName)).Wait(DEFAULT_TIMEOUT).Out.Contents() json.Unmarshal(cfResponse, &appsResponse) serverAppUrl := appsResponse.Resources[0].Metadata.Url // gather app stats for dea ip and app port var statsResponse StatsResponse cfResponse = cf.Cf("curl", fmt.Sprintf("%s/stats", serverAppUrl)).Wait(DEFAULT_TIMEOUT).Out.Contents() json.Unmarshal(cfResponse, &statsResponse) privateHost = statsResponse["0"].Stats.Host privatePort = statsResponse["0"].Stats.Port })
. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" "github.com/cloudfoundry-incubator/cf-test-helpers/cf" "github.com/cloudfoundry-incubator/cf-test-helpers/helpers" "github.com/cloudfoundry/cf-acceptance-tests/helpers/app_helpers" "github.com/cloudfoundry/cf-acceptance-tests/helpers/assets" "github.com/cloudfoundry/cf-acceptance-tests/helpers/random_name" ) var _ = AppsDescribe("Large_payload", func() { var appName string AfterEach(func() { app_helpers.AppReport(appName, Config.DefaultTimeoutDuration()) Expect(cf.Cf("delete", appName, "-f", "-r").Wait(Config.CfPushTimeoutDuration())).To(Exit(0)) }) It("should be able to curl for a large response body", func() { appName = random_name.CATSRandomName("APP") Expect(cf.Cf("push", appName, "--no-start", "-b", Config.GetRubyBuildpackName(), "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().Dora, "-d", Config.GetAppsDomain()).Wait(Config.DefaultTimeoutDuration())).To(Exit(0)) app_helpers.SetBackend(appName) Expect(cf.Cf("start", appName).Wait(Config.CfPushTimeoutDuration())).To(Exit(0)) Eventually(func() int { curlResponse := helpers.CurlApp(Config, appName, fmt.Sprintf("/largetext/5")) return len(curlResponse) }, 10*time.Second, 10*time.Second).Should(Equal(5 * 1024)) }) })
"crypto/tls" "strings" "encoding/json" "os" "path/filepath" ) var _ = Describe("loggregator", func() { var appName string const hundredthOfOneSecond = 10000 // this app uses millionth of seconds BeforeEach(func() { appName = generator.PrefixedRandomName("CATS-APP-") Expect(cf.Cf("push", appName, "--no-start", "-b", config.RubyBuildpackName, "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().LoggregatorLoadGenerator, "-d", config.AppsDomain).Wait(DEFAULT_TIMEOUT)).To(Exit(0)) app_helpers.SetBackend(appName) Expect(cf.Cf("start", appName).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) }) AfterEach(func() { app_helpers.AppReport(appName, DEFAULT_TIMEOUT) Expect(cf.Cf("delete", appName, "-f", "-r").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) }) Context("cf logs", func() { var logs *Session BeforeEach(func() { logs = cf.Cf("logs", appName)
. "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" "github.com/cloudfoundry-incubator/cf-test-helpers/cf" "github.com/cloudfoundry-incubator/cf-test-helpers/generator" "github.com/cloudfoundry/cf-acceptance-tests/helpers/assets" ) var _ = Describe("Downloading droplets", func() { var helloWorldAppName string var out bytes.Buffer BeforeEach(func() { helloWorldAppName = generator.PrefixedRandomName("CATS-APP-") Expect(cf.Cf("push", helloWorldAppName, "-p", assets.NewAssets().HelloWorld).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) }) AfterEach(func() { Expect(cf.Cf("delete", helloWorldAppName, "-f").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) }) It("Downloads the droplet for the app", func() { guid := cf.Cf("app", helloWorldAppName, "--guid").Wait(DEFAULT_TIMEOUT).Out.Contents() appGuid := strings.TrimSpace(string(guid)) tmpdir, err := ioutil.TempDir(os.TempDir(), "droplet-download") Expect(err).ToNot(HaveOccurred()) app_droplet_path := path.Join(tmpdir, helloWorldAppName)
package routing import ( "github.com/cloudfoundry-incubator/cf-test-helpers/helpers" "github.com/cloudfoundry/cf-acceptance-tests/helpers/app_helpers" "github.com/cloudfoundry/cf-acceptance-tests/helpers/assets" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Context Paths", func() { var ( app1 string helloRoutingAsset = assets.NewAssets().HelloRouting app2 string app2Path = "/app2" app3 string app3Path = "/app3/long/sub/path" domain string ) BeforeEach(func() { app1 = PushApp(helloRoutingAsset, config.RubyBuildpackName) app2 = PushApp(helloRoutingAsset, config.RubyBuildpackName) app3 = PushApp(helloRoutingAsset, config.RubyBuildpackName) domain = app1 MapRouteToApp(domain, app2Path, app2) MapRouteToApp(domain, app3Path, app3)
. "github.com/onsi/gomega/gexec" ) var _ = Describe(deaUnsupportedTag+"Route Services", func() { config := helpers.LoadConfig() if config.IncludeRouteServices { Context("when a route binds to a service", func() { Context("when service broker returns a route service url", func() { var ( brokerName string brokerAppName string serviceInstanceName string appName string routeServiceName string golangAsset = assets.NewAssets().Golang loggingRouteServiceAsset = assets.NewAssets().LoggingRouteServiceZip ) BeforeEach(func() { var serviceName string brokerName, brokerAppName, serviceName = createServiceBroker() serviceInstanceName = createServiceInstance(serviceName) appName = PushAppNoStart(golangAsset, config.GoBuildpackName) app_helpers.EnableDiego(appName) StartApp(appName) routeServiceName = PushApp(loggingRouteServiceAsset, config.GoBuildpackName) configureBroker(brokerAppName, routeServiceName)
"github.com/cloudfoundry/cf-acceptance-tests/helpers/assets" . "github.com/cloudfoundry/cf-acceptance-tests/helpers/services" ) var _ = Describe("SSO Lifecycle", func() { var broker ServiceBroker var config OAuthConfig var redirectUri string var apiEndpoint = helpers.LoadConfig().ApiEndpoint Describe("For service clients (provided in catalog)", func() { BeforeEach(func() { redirectUri = `http://www.purple.com` broker = NewServiceBroker(generator.RandomName(), assets.NewAssets().ServiceBroker, context, true) broker.Push() broker.Service.DashboardClient.RedirectUri = redirectUri broker.Configure() config = OAuthConfig{} config.ClientId = broker.Service.DashboardClient.ID config.ClientSecret = broker.Service.DashboardClient.Secret config.RedirectUri = redirectUri config.RequestedScopes = `openid,cloud_controller_service_permissions.read` SetOauthEndpoints(apiEndpoint, &config) broker.Create() })
spaceName = context.RegularUserContext().Space domainName = generator.RandomName() + "." + helpers.LoadConfig().AppsDomain cf.AsUser(context.AdminUserContext(), DEFAULT_TIMEOUT, func() { Expect(cf.Cf("create-shared-domain", domainName).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) }) appNameDora = generator.PrefixedRandomName("CATS-APP-") appNameSimple = generator.PrefixedRandomName("CATS-APP-") Expect(cf.Cf( "push", appNameDora, "--no-start", "-b", config.RubyBuildpackName, "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().Dora, "-d", config.AppsDomain, ).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) app_helpers.SetBackend(appNameDora) Expect(cf.Cf("start", appNameDora).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) Expect(cf.Cf( "push", appNameSimple, "--no-start", "-b", config.RubyBuildpackName, "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().HelloWorld, "-d", config.AppsDomain, ).Wait(CF_PUSH_TIMEOUT)).To(Exit(0))
"github.com/cloudfoundry-incubator/cf-test-helpers/generator" "github.com/cloudfoundry-incubator/cf-test-helpers/helpers" "github.com/cloudfoundry/cf-acceptance-tests/helpers/app_helpers" "github.com/cloudfoundry/cf-acceptance-tests/helpers/assets" ) const binaryHi = "Hello from a binary" var _ = Describe("Backend Compatibility", func() { var appName string BeforeEach(func() { appName = generator.PrefixedRandomName("CATS-APP-") Eventually(cf.Cf( "push", appName, "-p", assets.NewAssets().Binary, "--no-start", "-m", DEFAULT_MEMORY_LIMIT, "-b", "binary_buildpack", "-d", config.AppsDomain, "-c", "./app"), CF_PUSH_TIMEOUT).Should(Exit(0)) }) AfterEach(func() { app_helpers.AppReport(appName, DEFAULT_TIMEOUT) Eventually(cf.Cf("delete", appName, "-f"), DEFAULT_TIMEOUT).Should(Exit(0)) }) Describe("An app staged on Diego", func() { BeforeEach(func() {
runner.NewCmdRunner(curlCmd, DEFAULT_TIMEOUT).Run() Expect(string(curlCmd.Err.Contents())).To(HaveLen(0)) return string(curlCmd.Out.Contents()) } BeforeEach(func() { orgName = context.RegularUserContext().Org spaceName = context.RegularUserContext().Space domainName = generator.RandomName() + "." + helpers.LoadConfig().AppsDomain cf.AsUser(context.AdminUserContext(), DEFAULT_TIMEOUT, func() { Expect(cf.Cf("create-shared-domain", domainName).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) }) appNameDora = generator.PrefixedRandomName("CATS-APP-") Expect(cf.Cf("push", appNameDora, "-m", "128M", "-p", assets.NewAssets().Dora, "-d", config.AppsDomain).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) appNameSimple = generator.PrefixedRandomName("CATS-APP-") Expect(cf.Cf("push", appNameSimple, "-m", "128M", "-p", assets.NewAssets().HelloWorld, "-d", config.AppsDomain).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) }) AfterEach(func() { cf.AsUser(context.AdminUserContext(), DEFAULT_TIMEOUT, func() { Expect(cf.Cf("target", "-o", orgName).Wait(DEFAULT_TIMEOUT)).To(Exit(0)) Expect(cf.Cf("delete-shared-domain", domainName, "-f").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) }) Expect(cf.Cf("delete", appNameDora, "-f", "-r").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) Expect(cf.Cf("delete", appNameSimple, "-f", "-r").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) })
. "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" "github.com/cloudfoundry-incubator/cf-test-helpers/cf" "github.com/cloudfoundry-incubator/cf-test-helpers/generator" "github.com/cloudfoundry-incubator/cf-test-helpers/helpers" "github.com/cloudfoundry/cf-acceptance-tests/helpers/assets" ) var _ = Describe("Encoding", func() { var appName string BeforeEach(func() { appName = generator.PrefixedRandomName("CATS-APP-") Expect(cf.Cf("push", appName, "-p", assets.NewAssets().Java, "--no-start", "-m", "512M").Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) Expect(cf.Cf("set-env", appName, "JAVA_OPTS", "-Djava.security.egd=file:///dev/urandom").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) Expect(cf.Cf("start", appName).Wait(CF_JAVA_TIMEOUT)).To(Exit(0)) }) AfterEach(func() { Expect(cf.Cf("delete", appName, "-f").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) }) It("Does not corrupt UTF-8 characters in filenames", func() { var curlResponse string Eventually(func() string { curlResponse = helpers.CurlApp(appName, "/omega") return curlResponse }, DEFAULT_TIMEOUT).Should(ContainSubstring("It's Ω!")) Expect(curlResponse).To(ContainSubstring("File encoding is UTF-8"))
AfterEach(func() { app_helpers.AppReport(appName, DEFAULT_TIMEOUT) environment.Teardown() }) BeforeEach(func() { appName = config.PersistentAppHost appQuery := cf.Cf("app", appName).Wait(DEFAULT_TIMEOUT) // might exit with 1 or 0, depending on app status output := string(appQuery.Out.Contents()) if appQuery.ExitCode() == 1 && strings.Contains(output, "not found") { pushCommand := cf.Cf("push", appName, "--no-start", "-b", config.RubyBuildpackName, "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().Dora, "-d", config.AppsDomain).Wait(DEFAULT_TIMEOUT) if pushCommand.ExitCode() != 0 { Expect(cf.Cf("delete", "-f", "-r", appName).Wait(DEFAULT_TIMEOUT)).To(Exit(0)) Fail("failed to create app") } app_helpers.SetBackend(appName) startCommand := cf.Cf("start", appName).Wait(CF_PUSH_TIMEOUT) if startCommand.ExitCode() != 0 { Expect(cf.Cf("delete", "-f", "-r", appName).Wait(DEFAULT_TIMEOUT)).To(Exit(0)) Fail("persistent app failed to stage") } } if appQuery.ExitCode() == 0 && strings.Contains(output, "stopped") { Expect(cf.Cf("start", appName).Wait(DEFAULT_TIMEOUT)).To(Exit(0)) }
waitForAsyncOperationToComplete := func(broker ServiceBroker, instanceName string) { Eventually(func() *Session { serviceDetails := cf.Cf("service", instanceName).Wait(DEFAULT_TIMEOUT) Expect(serviceDetails).To(Exit(0), "failed getting service instance details") return serviceDetails }, ASYNC_OPERATION_TIMEOUT, ASYNC_OPERATION_POLL_INTERVAL).Should(Say("succeeded")) } type Params struct{ Param1 string } Context("Synchronous operations", func() { BeforeEach(func() { broker = NewServiceBroker( generator.PrefixedRandomName("pblc-brkr-"), assets.NewAssets().ServiceBroker, context, ) broker.Push() broker.Configure() broker.Create() broker.PublicizePlans() }) AfterEach(func() { app_helpers.AppReport(broker.Name, DEFAULT_TIMEOUT) broker.Destroy() }) Context("just service instances", func() {
appName string appGuid string packageGuid string spaceGuid string appCreationEnvironmentVariables string ) BeforeEach(func() { appName = generator.PrefixedRandomName("CATS-APP-") spaceGuid = GetSpaceGuidFromName(context.RegularUserContext().Space) appCreationEnvironmentVariables = `"foo"=>"bar"` appGuid = CreateApp(appName, spaceGuid, `{"foo":"bar"}`) packageGuid = CreatePackage(appGuid) token := GetAuthToken() uploadUrl := fmt.Sprintf("%s/v3/packages/%s/upload", config.ApiEndpoint, packageGuid) UploadPackage(uploadUrl, assets.NewAssets().DoraZip, token) WaitForPackageToBeReady(packageGuid) }) It("can run apps", func() { dropletGuid := StagePackage(packageGuid, "{}") WaitForDropletToStage(dropletGuid) AssignDropletToApp(appGuid, dropletGuid) var webProcess Process var workerProcess Process processes := getProcess(appGuid, appName) for _, process := range processes { if process.Type == "web" { webProcess = process
"path/filepath" ) var _ = AppsDescribe("loggregator", func() { var appName string const hundredthOfOneSecond = 10000 // this app uses millionth of seconds BeforeEach(func() { appName = CATSRandomName("APP") Expect(cf.Cf("push", appName, "--no-start", "-b", Config.GetRubyBuildpackName(), "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().LoggregatorLoadGenerator, "-d", Config.GetAppsDomain()).Wait(Config.CfPushTimeoutDuration())).To(Exit(0)) app_helpers.SetBackend(appName) Expect(cf.Cf("start", appName).Wait(Config.CfPushTimeoutDuration())).To(Exit(0)) }) AfterEach(func() { app_helpers.AppReport(appName, Config.DefaultTimeoutDuration()) Expect(cf.Cf("delete", appName, "-f", "-r").Wait(Config.DefaultTimeoutDuration())).To(Exit(0)) }) Context("cf logs", func() { var logs *Session BeforeEach(func() {
waitForAsyncOperationToComplete := func(broker ServiceBroker, instanceName string) { Eventually(func() *Session { serviceDetails := cf.Cf("service", instanceName).Wait(Config.DefaultTimeoutDuration()) Expect(serviceDetails).To(Exit(0), "failed getting service instance details") return serviceDetails }, Config.AsyncServiceOperationTimeoutDuration(), ASYNC_OPERATION_POLL_INTERVAL).Should(Say("succeeded")) } type Params struct{ Param1 string } Context("Synchronous operations", func() { BeforeEach(func() { broker = NewServiceBroker( random_name.CATSRandomName("BRKR"), assets.NewAssets().ServiceBroker, TestSetup, ) broker.Push(Config) broker.Configure() broker.Create() broker.PublicizePlans() }) AfterEach(func() { app_helpers.AppReport(broker.Name, Config.DefaultTimeoutDuration()) broker.Destroy() }) Context("just service instances", func() {
import ( "github.com/cloudfoundry-incubator/cf-test-helpers/cf" "github.com/cloudfoundry-incubator/cf-test-helpers/generator" "github.com/cloudfoundry-incubator/cf-test-helpers/helpers" "github.com/cloudfoundry/cf-acceptance-tests/helpers/assets" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" ) var _ = Describe("FUSE", func() { var appName string BeforeEach(func() { appName = generator.PrefixedRandomName("CATS-APP-") }) AfterEach(func() { Expect(cf.Cf("delete", appName, "-f").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) }) It("Can mount a fuse endpoint", func() { Expect(cf.Cf("push", appName, "-m", "128M", "-p", assets.NewAssets().Fuse, "-d", config.AppsDomain).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) Eventually(func() string { return helpers.CurlAppRoot(appName) }, DEFAULT_TIMEOUT).Should(ContainSubstring("great success!")) }) })
. "code.cloudfoundry.org/cf-routing-test-helpers/helpers" "github.com/cloudfoundry-incubator/cf-test-helpers/helpers" "github.com/cloudfoundry/cf-acceptance-tests/helpers/assets" "github.com/cloudfoundry/cf-acceptance-tests/helpers/random_name" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/gexec" ) const ( VCAP_ID = "__VCAP_ID__" ) var _ = RoutingDescribe("Session Affinity", func() { var stickyAsset = assets.NewAssets().HelloRouting Context("when an app sets a JSESSIONID cookie", func() { var ( appName string cookieStorePath string ) BeforeEach(func() { appName = random_name.CATSRandomName("APP") PushApp(appName, stickyAsset, Config.GetRubyBuildpackName(), Config.GetAppsDomain(), Config.CfPushTimeoutDuration(), DEFAULT_MEMORY_LIMIT) cookieStore, err := ioutil.TempFile("", "cats-sticky-session") Expect(err).ToNot(HaveOccurred()) cookieStorePath = cookieStore.Name() cookieStore.Close() })
. "github.com/cloudfoundry/cf-acceptance-tests/helpers/services" ) var _ = Describe("Service Broker Lifecycle", func() { var broker ServiceBroker Describe("public brokers", func() { var acls *Session var output []byte var oldServiceName string var oldPlanName string BeforeEach(func() { broker = NewServiceBroker( generator.PrefixedRandomName("pblc-brkr-"), assets.NewAssets().ServiceBroker, context, ) cf.TargetSpace(context.RegularUserContext(), context.ShortTimeout()) broker.Push() broker.Configure() cf.AsUser(context.AdminUserContext(), context.ShortTimeout(), func() { broker.Create() }) }) Describe("Updating the catalog", func() { BeforeEach(func() { broker.PublicizePlans()
import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" "github.com/cloudfoundry-incubator/cf-test-helpers/cf" "github.com/cloudfoundry-incubator/cf-test-helpers/generator" "github.com/cloudfoundry-incubator/cf-test-helpers/helpers" "github.com/cloudfoundry/cf-acceptance-tests/helpers/assets" ) var _ = Describe("GitBuildpack", func() { var ( appName string ) It("uses a buildpack from a git url", func() { appName = generator.PrefixedRandomName("CATS-APP-") Expect(cf.Cf("push", appName, "-m", "128M", "-p", assets.NewAssets().Node, "-b", "https://github.com/cloudfoundry/nodejs-buildpack.git#v1.3.1").Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) Eventually(func() string { return helpers.CurlAppRoot(appName) }, DEFAULT_TIMEOUT).Should(ContainSubstring("Hello from a node app!")) }) AfterEach(func() { Expect(cf.Cf("delete", appName, "-f").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) }) })
) var _ = Describe("Buildpacks", func() { var appName string BeforeEach(func() { appName = generator.PrefixedRandomName("CATS-APP-") }) AfterEach(func() { Expect(cf.Cf("delete", appName, "-f").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) }) Describe("node", func() { It("makes the app reachable via its bound route", func() { Expect(cf.Cf("push", appName, "-p", assets.NewAssets().Node, "-d", config.AppsDomain).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) Eventually(func() string { return helpers.CurlAppRoot(appName) }, DEFAULT_TIMEOUT).Should(ContainSubstring("Hello from a node app!")) }) }) Describe("java", func() { It("makes the app reachable via its bound route", func() { Expect(cf.Cf("push", appName, "-p", assets.NewAssets().Java, "--no-start", "-m", "512M", "-d", config.AppsDomain).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) Expect(cf.Cf("set-env", appName, "JAVA_OPTS", "-Djava.security.egd=file:///dev/urandom").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) Expect(cf.Cf("start", appName).Wait(CF_JAVA_TIMEOUT)).To(Exit(0)) Eventually(func() string { return helpers.CurlAppRoot(appName)
for _, event := range response.Resources { if event.Entity.AppName == appName && event.Entity.State == state { return true, event } } return false, AppUsageEvent{} } var _ = Describe("Application Lifecycle", func() { var appName string BeforeEach(func() { appName = generator.PrefixedRandomName("CATS-APP-") Expect(cf.Cf("push", appName, "--no-start", "-b", config.RubyBuildpackName, "-m", DEFAULT_MEMORY_LIMIT, "-p", assets.NewAssets().Dora, "-d", config.AppsDomain).Wait(DEFAULT_TIMEOUT)).To(Exit(0)) app_helpers.SetBackend(appName) Expect(cf.Cf("start", appName).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) }) AfterEach(func() { app_helpers.AppReport(appName, DEFAULT_TIMEOUT) Expect(cf.Cf("delete", appName, "-f", "-r").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) }) Describe("pushing", func() { It("makes the app reachable via its bound route", func() { Eventually(func() string { return helpers.CurlAppRoot(appName) }, DEFAULT_TIMEOUT).Should(ContainSubstring("Hi, I'm Dora!"))
. "github.com/onsi/gomega" . "github.com/onsi/gomega/gexec" "github.com/cloudfoundry-incubator/cf-test-helpers/cf" "github.com/cloudfoundry-incubator/cf-test-helpers/generator" "github.com/cloudfoundry/cf-acceptance-tests/helpers/assets" ) var _ = Describe("Downloading droplets", func() { var helloWorldAppName string var out bytes.Buffer BeforeEach(func() { helloWorldAppName = generator.PrefixedRandomName("CATS-APP-") Expect(cf.Cf("push", helloWorldAppName, "-p", assets.NewAssets().HelloWorld, "-d", config.AppsDomain).Wait(CF_PUSH_TIMEOUT)).To(Exit(0)) }) AfterEach(func() { Expect(cf.Cf("delete", helloWorldAppName, "-f").Wait(DEFAULT_TIMEOUT)).To(Exit(0)) }) It("Downloads the droplet for the app", func() { guid := cf.Cf("app", helloWorldAppName, "--guid").Wait(DEFAULT_TIMEOUT).Out.Contents() appGuid := strings.TrimSpace(string(guid)) tmpdir, err := ioutil.TempDir(os.TempDir(), "droplet-download") Expect(err).ToNot(HaveOccurred()) app_droplet_path := path.Join(tmpdir, helloWorldAppName)