. "github.com/onsi/gomega" . "github.com/cloudcredo/bosh-lattice-cpi/action" fakestem "github.com/cloudcredo/bosh-lattice-cpi/softlayer/stemcell/fakes" fakevm "github.com/cloudcredo/bosh-lattice-cpi/softlayer/vm/fakes" bslcvm "github.com/cloudcredo/bosh-lattice-cpi/softlayer/vm" sldatatypes "github.com/maximilien/softlayer-go/data_types" ) var _ = Describe("CreateVM", func() { var ( stemcellFinder *fakestem.FakeFinder vmCreator *fakevm.FakeCreator action CreateVM ) BeforeEach(func() { stemcellFinder = &fakestem.FakeFinder{} vmCreator = &fakevm.FakeCreator{} action = NewCreateVM(stemcellFinder, vmCreator) }) Describe("Run", func() { var ( stemcellCID StemcellCID vmCloudProp bslcvm.VMCloudProperties networks Networks diskLocality []DiskCID
package action_test import ( "errors" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudcredo/bosh-lattice-cpi/action" fakestem "github.com/cloudcredo/bosh-lattice-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)))