Пример #1
0
	})

	Describe(".Name", func() {
		It("returns the pipeline name", func() {
			pipeline := task.NewPipeline("some-pipeline", logger)

			Expect(pipeline.Name()).To(Equal("some-pipeline"))
		})

	})

	Describe(".Run", func() {
		var (
			task1            *fakeTask
			task2            *fakeTask
			originalArtifact = task.NewArtifact("path/to/artifact")
			finalArtifact    task.Artifact
			runErr           error
		)

		Context("with multiple successful tasks", func() {
			BeforeEach(func() {
				task1 = &fakeTask{TaskName: "task1"}
				task2 = &fakeTask{TaskName: "task2"}

				pipeline := task.NewPipeline("some-name", logger, task1, task2)

				finalArtifact, runErr = pipeline.Run(originalArtifact)
			})

			It("executes all tasks with given artifact", func() {
Пример #2
0
	"github.com/pivotal-golang/lager"
)

var _ = Describe("Rename", func() {
	Describe(".Name", func() {
		It("returns name", func() {
			Expect(task.NewRename("blah", nil).Name()).To(Equal("rename"))
		})
	})

	Describe(".Run", func() {
		var (
			tmpDirPath      string
			originalPath    string
			finalPath       string
			renamedArtifact task.Artifact
			runErr          error
			logger          lager.Logger
			log             *gbytes.Buffer
		)

		BeforeEach(func() {
			tmpDirPath, err := ioutil.TempDir("", "temp")
			Expect(err).ToNot(HaveOccurred())

			finalPath = filepath.Join(tmpDirPath, "newName")
			Expect(finalPath).ToNot(BeAnExistingFile())

			file, err := ioutil.TempFile(tmpDirPath, "artifact")
			Expect(err).ToNot(HaveOccurred())
	"github.com/pivotal-cf/cf-redis-broker/redis/client/fakes"
	"github.com/pivotal-golang/lager"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"
)

var _ = Describe("Snapshotter", func() {
	Describe(".Snapshot", func() {
		var (
			artifact task.Artifact
			err      error

			snapshotter recovery.Snapshotter

			fakeRedisClient      *fakes.Client
			expectedArtifactPath = "the/artifact/path"
			logger               lager.Logger
			log                  *gbytes.Buffer
			timeout              time.Duration
		)

		BeforeEach(func() {
			fakeRedisClient = &fakes.Client{
				ExpectedRDBPath: expectedArtifactPath,
			}
			timeout = 123 * time.Second
			logger = lager.NewLogger("logger")
			log = gbytes.NewBuffer()
			logger.RegisterSink(lager.NewWriterSink(log, lager.INFO))
			snapshotter = backup.NewSnapshotter(fakeRedisClient, timeout, logger)
Пример #4
0
	"github.com/pivotal-golang/lager"
)

var _ = Describe("RedisBackuper", func() {
	Describe(".Backup", func() {
		var (
			backupErr       error
			log             *gbytes.Buffer
			tmpDir          string
			logger          lager.Logger
			providerFactory *fakes.FakeProviderFactory
			snapshotter     *fakes.FakeSnapshotter
			initialArtifact task.Artifact
			renameTask      *fakes.FakeTask
			s3UploadTask    *fakes.FakeTask
			cleanupTask     *fakes.FakeTask
			redisClient     *fakes.FakeRedisClient
			backuper        backup.RedisBackuper

			expectedTimeout    = 123 * time.Second
			expectedBucketName = "some-bucket-name"
			expectedTargetPath = "some-target-path"
			expectedEndpoint   = "some-endpoint"
			expectedAccessKey  = "some-access-key"
			expectedSecretKey  = "some-secret-key"
		)

		BeforeEach(func() {
			log = gbytes.NewBuffer()
			logger = lager.NewLogger("logger")
			logger.RegisterSink(lager.NewWriterSink(log, lager.INFO))