diff --git a/acceptance-tests/postgresql_test.go b/acceptance-tests/postgresql_test.go index 72f46186..439112d2 100644 --- a/acceptance-tests/postgresql_test.go +++ b/acceptance-tests/postgresql_test.go @@ -129,19 +129,58 @@ var _ = Describe("PostgreSQL", func() { serviceInstance := services.CreateInstance("csb-google-postgres", "small") defer serviceInstance.Delete() - postgresTestMultipleApps(serviceInstance) + By("pushing the unstarted app twice") + appOne := apps.Push(apps.WithApp(apps.PostgreSQL)) + appTwo := apps.Push(apps.WithApp(apps.PostgreSQL)) + defer apps.Delete(appOne, appTwo) - }) + By("binding the first app to the service instance") + binding := serviceInstance.Bind(appOne) - It("works with latest changes to public schema in postgres 15", Label("Postgres15"), func() { - By("creating a service instance") - serviceInstance := services.CreateInstance("csb-google-postgres", "pg15") - defer serviceInstance.Delete() + By("starting the first app") + apps.Start(appOne) - postgresTestMultipleApps(serviceInstance) + By("checking that the app environment has a credhub reference for credentials") + Expect(binding.Credential()).To(matchers.HaveCredHubRef) - }) + By("creating a schema using the first app") + schema := random.Name(random.WithMaxLength(10)) + appOne.PUT("", schema) + + By("setting a key-value using the first app") + key := random.Hexadecimal() + value := random.Hexadecimal() + appOne.PUT(value, "%s/%s", schema, key) + + By("binding the second app to the service instance") + serviceInstance.Bind(appTwo) + + By("starting the second app") + apps.Start(appTwo) + + By("getting the value using the second app") + got := appTwo.GET("%s/%s", schema, key).String() + Expect(got).To(Equal(value)) + + By("triggering ownership of schema to pass to provision user") + binding.Unbind() + + By("getting the value again using the second app") + got2 := appTwo.GET("%s/%s", schema, key).String() + Expect(got2).To(Equal(value)) + By("setting another value using the second app") + key2 := random.Hexadecimal() + value2 := random.Hexadecimal() + appTwo.PUT(value2, "%s/%s", schema, key2) + + By("getting the other value using the second app") + got3 := appTwo.GET("%s/%s", schema, key2).String() + Expect(got3).To(Equal(value2)) + + By("dropping the schema using the second app") + appTwo.DELETE(schema) + }) }) It("can create service keys with a public IP address", Label("postgresql-public-ip"), func() { @@ -170,60 +209,3 @@ var _ = Describe("PostgreSQL", func() { Expect(uriIP.IsPrivate()).To(BeFalse()) }) }) - -func postgresTestMultipleApps(serviceInstance *services.ServiceInstance) { - GinkgoHelper() - - By("pushing the unstarted app twice") - appOne := apps.Push(apps.WithApp(apps.PostgreSQL)) - appTwo := apps.Push(apps.WithApp(apps.PostgreSQL)) - defer apps.Delete(appOne, appTwo) - - By("binding the first app to the service instance") - binding := serviceInstance.Bind(appOne) - - By("starting the first app") - apps.Start(appOne) - - By("checking that the app environment has a credhub reference for credentials") - Expect(binding.Credential()).To(matchers.HaveCredHubRef) - - By("creating a schema using the first app") - schema := random.Name(random.WithMaxLength(10)) - appOne.PUT("", schema) - - By("setting a key-value using the first app") - key := random.Hexadecimal() - value := random.Hexadecimal() - appOne.PUT(value, "%s/%s", schema, key) - - By("binding the second app to the service instance") - serviceInstance.Bind(appTwo) - - By("starting the second app") - apps.Start(appTwo) - - By("getting the value using the second app") - got := appTwo.GET("%s/%s", schema, key).String() - Expect(got).To(Equal(value)) - - By("triggering ownership of schema to pass to provision user") - binding.Unbind() - - By("getting the value again using the second app") - got2 := appTwo.GET("%s/%s", schema, key).String() - Expect(got2).To(Equal(value)) - - By("setting another value using the second app") - key2 := random.Hexadecimal() - value2 := random.Hexadecimal() - appTwo.PUT(value2, "%s/%s", schema, key2) - - By("getting the other value using the second app") - got3 := appTwo.GET("%s/%s", schema, key2).String() - Expect(got3).To(Equal(value2)) - - By("dropping the schema using the second app") - appTwo.DELETE(schema) - -}