Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove PostgreSQL 15 test #1143

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 47 additions & 65 deletions acceptance-tests/postgresql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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)

}
Loading