|
| 1 | +package integration_test |
| 2 | + |
| 3 | +import ( |
| 4 | + "os" |
| 5 | + |
| 6 | + "github.com/cloudfoundry/storage-cli/s3/config" |
| 7 | + "github.com/cloudfoundry/storage-cli/s3/integration" |
| 8 | + |
| 9 | + . "github.com/onsi/ginkgo/v2" |
| 10 | + . "github.com/onsi/gomega" |
| 11 | +) |
| 12 | + |
| 13 | +var _ = Describe("Testing for AWS European Sovereign Cloud region", func() { |
| 14 | + Context("with AWS ESC (static creds) configurations", func() { |
| 15 | + accessKeyID := os.Getenv("ACCESS_KEY_ID") |
| 16 | + secretAccessKey := os.Getenv("SECRET_ACCESS_KEY") |
| 17 | + bucketName := os.Getenv("BUCKET_NAME") |
| 18 | + region := os.Getenv("REGION") |
| 19 | + s3Host := os.Getenv("S3_HOST") |
| 20 | + |
| 21 | + BeforeEach(func() { |
| 22 | + Expect(accessKeyID).ToNot(BeEmpty(), "ACCESS_KEY_ID must be set") |
| 23 | + Expect(secretAccessKey).ToNot(BeEmpty(), "SECRET_ACCESS_KEY must be set") |
| 24 | + Expect(bucketName).ToNot(BeEmpty(), "BUCKET_NAME must be set") |
| 25 | + Expect(region).ToNot(BeEmpty(), "REGION must be set") |
| 26 | + Expect(s3Host).ToNot(BeEmpty(), "S3_HOST must be set") |
| 27 | + }) |
| 28 | + |
| 29 | + configurations := []TableEntry{ |
| 30 | + Entry("with region and without host", &config.S3Cli{ |
| 31 | + AccessKeyID: accessKeyID, |
| 32 | + SecretAccessKey: secretAccessKey, |
| 33 | + BucketName: bucketName, |
| 34 | + Region: region, |
| 35 | + }), |
| 36 | + Entry("with folder", &config.S3Cli{ |
| 37 | + AccessKeyID: accessKeyID, |
| 38 | + SecretAccessKey: secretAccessKey, |
| 39 | + BucketName: bucketName, |
| 40 | + FolderName: "test-folder/a-folder", |
| 41 | + Region: region, |
| 42 | + }), |
| 43 | + Entry("with host style enabled", &config.S3Cli{ |
| 44 | + AccessKeyID: accessKeyID, |
| 45 | + SecretAccessKey: secretAccessKey, |
| 46 | + BucketName: bucketName, |
| 47 | + Region: region, |
| 48 | + HostStyle: true, |
| 49 | + }), |
| 50 | + } |
| 51 | + DescribeTable("Blobstore lifecycle works", |
| 52 | + func(cfg *config.S3Cli) { integration.AssertLifecycleWorks(s3CLIPath, cfg) }, |
| 53 | + configurations, |
| 54 | + ) |
| 55 | + |
| 56 | + DescribeTable("Invoking `ensure-storage-exists` works", |
| 57 | + func(cfg *config.S3Cli) { integration.AssertOnStorageExists(s3CLIPath, cfg) }, |
| 58 | + configurations, |
| 59 | + ) |
| 60 | + DescribeTable("Blobstore bulk operations work", |
| 61 | + func(cfg *config.S3Cli) { integration.AssertOnBulkOperations(s3CLIPath, cfg) }, |
| 62 | + configurations, |
| 63 | + ) |
| 64 | + DescribeTable("Invoking `s3cli get` on a non-existent-key fails", |
| 65 | + func(cfg *config.S3Cli) { integration.AssertGetNonexistentFails(s3CLIPath, cfg) }, |
| 66 | + configurations, |
| 67 | + ) |
| 68 | + DescribeTable("Invoking `s3cli delete` on a non-existent-key does not fail", |
| 69 | + func(cfg *config.S3Cli) { integration.AssertDeleteNonexistentWorks(s3CLIPath, cfg) }, |
| 70 | + configurations, |
| 71 | + ) |
| 72 | + DescribeTable("Invoking `s3cli sign` returns a signed URL", |
| 73 | + func(cfg *config.S3Cli) { integration.AssertOnSignedURLs(s3CLIPath, cfg) }, |
| 74 | + configurations, |
| 75 | + ) |
| 76 | + DescribeTable("Multipart copy works with low threshold", |
| 77 | + func(cfg *config.S3Cli) { integration.AssertMultipartCopyWorks(s3CLIPath, cfg) }, |
| 78 | + configurations, |
| 79 | + ) |
| 80 | + |
| 81 | + configurations = []TableEntry{ |
| 82 | + Entry("with encryption", &config.S3Cli{ |
| 83 | + AccessKeyID: accessKeyID, |
| 84 | + SecretAccessKey: secretAccessKey, |
| 85 | + BucketName: bucketName, |
| 86 | + Region: region, |
| 87 | + ServerSideEncryption: "AES256", |
| 88 | + }), |
| 89 | + Entry("without encryption", &config.S3Cli{ |
| 90 | + AccessKeyID: accessKeyID, |
| 91 | + SecretAccessKey: secretAccessKey, |
| 92 | + BucketName: bucketName, |
| 93 | + Region: region, |
| 94 | + }), |
| 95 | + } |
| 96 | + DescribeTable("Invoking `s3cli put` uploads with options", |
| 97 | + func(cfg *config.S3Cli) { integration.AssertPutOptionsApplied(s3CLIPath, cfg) }, |
| 98 | + configurations, |
| 99 | + ) |
| 100 | + |
| 101 | + Describe("Invoking `s3cli put` with arbitrary upload failures", func() { |
| 102 | + It("returns the appropriate error message", func() { |
| 103 | + cfg := &config.S3Cli{ |
| 104 | + AccessKeyID: accessKeyID, |
| 105 | + SecretAccessKey: secretAccessKey, |
| 106 | + BucketName: bucketName, |
| 107 | + Host: "http://localhost", |
| 108 | + } |
| 109 | + msg := "upload failure" |
| 110 | + integration.AssertOnPutFailures(cfg, largeContent, msg) |
| 111 | + }) |
| 112 | + }) |
| 113 | + |
| 114 | + Describe("Invoking `s3cli put` with multipart upload failures", func() { |
| 115 | + It("returns the appropriate error message", func() { |
| 116 | + cfg := &config.S3Cli{ |
| 117 | + AccessKeyID: accessKeyID, |
| 118 | + SecretAccessKey: secretAccessKey, |
| 119 | + BucketName: bucketName, |
| 120 | + Region: region, |
| 121 | + MultipartUpload: true, |
| 122 | + } |
| 123 | + msg := "upload retry limit exceeded" |
| 124 | + integration.AssertOnPutFailures(cfg, largeContent, msg) |
| 125 | + }) |
| 126 | + }) |
| 127 | + }) |
| 128 | +}) |
0 commit comments