}) Describe(".Run", func() { var ( expectedSourcePath = "path/to/source" expectedTargetPath = "path/to/target" expectedBucketName = "some-bucket-name" artifactOut task.Artifact runErr error client *fakeS3Client bucket *fakeS3Bucket upload task.Task ) JustBeforeEach(func() { artifactOut, runErr = upload.Run(task.NewArtifact(expectedSourcePath)) }) BeforeEach(func() { bucket = &fakeS3Bucket{ BucketName: expectedBucketName, } client = &fakeS3Client{ GetOrCreateBucketResult: bucket, } upload = task.NewS3Upload( expectedBucketName, expectedTargetPath, "endpoint",
logger.RegisterSink(lager.NewWriterSink(log, lager.INFO)) artifactIn = task.NewArtifact("path/to/artifact") var err error redisDir, err = ioutil.TempDir("", "cleanup-test") Expect(err).ToNot(HaveOccurred()) originalDumpPath = filepath.Join(redisDir, "dump.rdb") renamedDumpPath = filepath.Join(redisDir, "renamed.rdb") cleanup = backup.NewCleanup(originalDumpPath, renamedDumpPath, logger) }) JustBeforeEach(func() { artifactOut, runErr = cleanup.Run(artifactIn) }) AfterEach(func() { os.RemoveAll(redisDir) }) Context("when the artifact is nil", func() { BeforeEach(func() { artifactIn = nil }) It("does not return an error", func() { Expect(runErr).ToNot(HaveOccurred()) }) })