logger.RegisterSink(lager.NewWriterSink(log, lager.INFO)) }) Describe(".Name", func() { It("returns the correct name", func() { upload := task.NewS3Upload("bucket", "target", "endpoint", "key", "secret", logger) Expect(upload.Name()).To(Equal("s3upload")) }) }) 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{
var _ = Describe("Cleanup", func() { Context(".Name", func() { It("returns the name", func() { cleanupTask := backup.NewCleanup("dumpRdb", "renamedRdb", nil) Expect(cleanupTask.Name()).To(Equal("cleanup")) }) }) Context(".Run", func() { var ( originalDumpPath string renamedDumpPath string redisDir string cleanup task.Task artifactIn task.Artifact artifactOut task.Artifact runErr error log *gbytes.Buffer logger lager.Logger ) BeforeEach(func() { log = gbytes.NewBuffer() logger = lager.NewLogger("redis") logger.RegisterSink(lager.NewWriterSink(log, lager.INFO)) artifactIn = task.NewArtifact("path/to/artifact") var err error redisDir, err = ioutil.TempDir("", "cleanup-test")