forked from cloudfoundry/csb-brokerpak-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths3_test.go
48 lines (37 loc) · 1.4 KB
/
s3_test.go
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
package acceptance_tests_test
import (
"fmt"
"time"
"csbbrokerpakaws/acceptance-tests/helpers/apps"
"csbbrokerpakaws/acceptance-tests/helpers/random"
"csbbrokerpakaws/acceptance-tests/helpers/services"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("S3", Label("s3"), func() {
It("can be accessed by an app", func() {
By("creating a service instance")
serviceInstance := services.CreateInstance("csb-aws-s3-bucket", "private")
defer serviceInstance.Delete()
By("pushing the unstarted app twice")
appOne := apps.Push(apps.WithApp(apps.S3))
appTwo := apps.Push(apps.WithApp(apps.S3))
defer apps.Delete(appOne, appTwo)
By("binding the apps to the s3 service instance")
binding := serviceInstance.Bind(appOne)
serviceInstance.Bind(appTwo)
By("starting the apps")
apps.Start(appOne, appTwo)
By("checking that the app environment has a credhub reference for credentials")
Expect(binding.Credential()).To(HaveKey("credhub-ref"))
By("uploading a file using the first app")
filename := random.Hexadecimal()
fileContent := fmt.Sprintf("This is a dummy file that will be uploaded the S3 at %s.", time.Now().String())
appOne.PUT(fileContent, filename)
By("downloading the file using the second app")
got := appTwo.GET(filename)
Expect(got).To(Equal(fileContent))
By("deleting the file from bucket using the second app")
appTwo.DELETE(filename)
})
})