"errors" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/bosh-softlayer-cpi/action" fakestem "github.com/cloudfoundry/bosh-softlayer-cpi/softlayer/stemcell/fakes" boshlog "github.com/cloudfoundry/bosh-utils/logger" ) var _ = Describe("DeleteStemcell", func() { var ( stemcellFinder *fakestem.FakeFinder action DeleteStemcell logger boshlog.Logger ) BeforeEach(func() { stemcellFinder = &fakestem.FakeFinder{} logger = boshlog.NewLogger(boshlog.LevelNone) action = NewDeleteStemcell(stemcellFinder, logger) }) Describe("Run", func() { It("tries to find stemcell with given stemcell cid", func() { _, err := action.Run(1234) Expect(err).ToNot(HaveOccurred())
package action_test import ( "errors" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/bosh-softlayer-cpi/action" fakestem "github.com/cloudfoundry/bosh-softlayer-cpi/softlayer/stemcell/fakes" ) var _ = Describe("CreateStemcell", func() { var ( stemcellFinder *fakestem.FakeFinder action CreateStemcell ) BeforeEach(func() { stemcellFinder = &fakestem.FakeFinder{} action = NewCreateStemcell(stemcellFinder) }) Describe("Run", func() { It("returns id for created stemcell from image path", func() { stemcellFinder.FindFound, stemcellFinder.FindErr = true, nil stemcellFinder.FindStemcell = fakestem.NewFakeStemcell(1234, "fake-stemcell-id", fakestem.FakeStemcellKind) id, err := action.Run("fake-path", CreateStemcellCloudProps{Uuid: "fake-stemcell-id"}) Expect(err).ToNot(HaveOccurred()) Expect(id).To(Equal(StemcellCID(1234).String()))