func NewStandardRegionDriverSet(logDest io.Writer, creds config.Credentials) StandardRegionDriverSet { return &standardRegionDriverSet{ machineImageDriver: struct { *driver.SDKCreateMachineImageDriver *driver.SDKDeleteMachineImageDriver }{ driver.NewCreateMachineImageDriver(logDest, creds), driver.NewDeleteMachineImageDriver(logDest, creds), }, snapshotDriver: driver.NewSnapshotFromImageDriver(logDest, creds), amiDriver: driver.NewCreateAmiDriver(logDest, creds), copyAmiDriver: driver.NewCopyAmiDriver(logDest, creds), } }
Expect(imagePath).ToNot(BeEmpty(), "MACHINE_IMAGE_PATH must be set") imageFormat = os.Getenv("MACHINE_IMAGE_FORMAT") Expect(imageFormat).ToNot(BeEmpty(), "MACHINE_IMAGE_FORMAT must be set") bucketName = os.Getenv("AWS_BUCKET_NAME") Expect(bucketName).ToNot(BeEmpty(), "AWS_BUCKET_NAME must be set") }) It("uploads a machine image to S3 with pre-signed URLs for GET and DELETE", func() { driverConfig := resources.MachineImageDriverConfig{ MachineImagePath: imagePath, BucketName: bucketName, } createDriver := driver.NewCreateMachineImageDriver(GinkgoWriter, creds) machineImage, err := createDriver.Create(driverConfig) Expect(err).ToNot(HaveOccurred()) resp, err := http.Get(machineImage.GetURL) Expect(err).ToNot(HaveOccurred()) defer resp.Body.Close() Expect(resp.StatusCode).To(Equal(http.StatusOK)) deleteDriver := driver.NewDeleteMachineImageDriver(GinkgoWriter, creds) err = deleteDriver.Delete(machineImage) Expect(err).ToNot(HaveOccurred())