コード例 #1
0
	bucketName := "test-bucket"
	targetPath := "target"

	bucket := goamzBucket(bucketName, s3Server.URL())
	_, err = bucket.Get(targetPath)
	Expect(err).To(HaveOccurred())

	tmpDir, err = ioutil.TempDir("", "redis-backups-integration-tests")
	Expect(err).NotTo(HaveOccurred())

	backuper := backup.NewRedisBackuper(
		10*time.Second,
		bucketName,
		s3Server.URL(),
		"access-key",
		"secret-key",
		tmpDir,
		logger,
	)

	backupErr = backuper.Backup(
		client,
		targetPath,
	)

	uploadedObject, err = bucket.Get(targetPath)
	Expect(err).ToNot(HaveOccurred())
})

var _ = AfterSuite(func() {
コード例 #2
0
			providerFactory.CleanupTaskProviderReturns(cleanupTask)

			redisClient = new(fakes.FakeRedisClient)
			redisClient.AddressReturns("test-host:1446")

			var err error
			tmpDir, err = ioutil.TempDir("", "redis-backups-test")
			Expect(err).NotTo(HaveOccurred())

			backuper = backup.NewRedisBackuper(
				expectedTimeout,
				expectedBucketName,
				expectedEndpoint,
				expectedAccessKey,
				expectedSecretKey,
				tmpDir,
				logger,
				backup.InjectSnapshotterProvider(providerFactory.SnapshotterProvider),
				backup.InjectRenameTaskProvider(providerFactory.RenameTaskProvider),
				backup.InjectS3UploadTaskProvider(providerFactory.S3UploadTaskProvider),
				backup.InjectCleanupTaskProvider(providerFactory.CleanupTaskProvider),
			)
		})

		AfterEach(func() {
			Expect(os.RemoveAll(tmpDir)).To(Succeed())
		})

		JustBeforeEach(func() {
			backupErr = backuper.Backup(
				redisClient,