示例#1
0
		Describe("Validate", func() {
			var action *models.Action

			Context("when the action has no inner actions", func() {
				It("is valid", func() {
					action = nil

					err := action.Validate()
					Expect(err).NotTo(HaveOccurred())
				})
			})
		})
	})

	Describe("Download", func() {
		var downloadAction *models.DownloadAction

		Context("with checksum algorithm and value missing", func() {
			itSerializesAndDeserializes(
				`{
					"artifact": "mouse",
					"from": "web_location",
					"to": "local_location",
					"cache_key": "elephant",
					"user": "******"
			}`,
				models.WrapAction(&models.DownloadAction{
					Artifact: "mouse",
					From:     "web_location",
					To:       "local_location",
					CacheKey: "elephant",
示例#2
0
	"github.com/cloudfoundry-incubator/executor/depot/log_streamer/fake_log_streamer"
	"github.com/cloudfoundry-incubator/executor/depot/steps"
	"github.com/cloudfoundry-incubator/executor/fakes"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gbytes"

	archiveHelper "github.com/pivotal-golang/archiver/extractor/test_helper"
)

var _ = Describe("DownloadAction", func() {
	var (
		step steps.Step

		downloadAction models.DownloadAction
		cache          *cdfakes.FakeCachedDownloader
		gardenClient   *fakes.FakeGardenClient
		fakeStreamer   *fake_log_streamer.FakeLogStreamer
		logger         *lagertest.TestLogger
		rateLimiter    chan struct{}
	)

	handle := "some-container-handle"

	BeforeEach(func() {
		cache = &cdfakes.FakeCachedDownloader{}
		cache.FetchReturns(ioutil.NopCloser(new(bytes.Buffer)), 42, nil)

		downloadAction = models.DownloadAction{
			From:     "http://mr_jones",
			To:       "/tmp/Antarctica",
			CacheKey: "the-cache-key",