コード例 #1
0
	Describe("Run", func() {
		It("tries to find stemcell with given stemcell cid", func() {
			_, err := action.Run(1234)
			Expect(err).ToNot(HaveOccurred())

			Expect(stemcellFinder.FindID).To(Equal(1234))
		})

		Context("when stemcell is found with given stemcell cid", func() {
			var (
				stemcell *fakestem.FakeStemcell
			)

			BeforeEach(func() {
				stemcell = fakestem.NewFakeStemcell(1234, "fake-stemcell-id", fakestem.FakeStemcellKind)
				stemcellFinder.FindStemcell = stemcell
				stemcellFinder.FindFound = true
			})

			It("does not delete stemcell", func() {
				_, err := action.Run(1234)
				Expect(err).ToNot(HaveOccurred())

				Expect(stemcell.DeleteCalled).To(BeFalse())
			})

			It("logs instead of returning error if deleting stemcell fails", func() {
				stemcell.DeleteErr = errors.New("fake-delete-err")

				_, err := action.Run(1234)
コード例 #2
0
			})
		})
	})

	Describe("ReloadOS", func() {
		Context("valid VM ID is used", func() {
			BeforeEach(func() {
				fileNames := []string{
					"SoftLayer_Virtual_Guest_Service_getActiveTransactions_None.json",
					"SoftLayer_Virtual_Guest_Service_reloadOS.json",
					"SoftLayer_Virtual_Guest_Service_getActiveTransactions.json",
					"SoftLayer_Virtual_Guest_Service_getPowerState.json",
				}
				testhelpers.SetTestFixturesForFakeSoftLayerClient(fakeSoftLayerClient, fileNames)
				vm = NewSoftLayerVM(1234567, fakeSoftLayerClient, sshClient, agentEnvService, logger)
				stemcell = fakestemcell.NewFakeStemcell(123456, "5b7bc66a-72c6-447a-94a1-967803fcd76b", "non-dea")
			})

			It("os reload on the VM successfully", func() {
				err := vm.ReloadOS(stemcell)
				Expect(err).ToNot(HaveOccurred())
			})
		})
	})

	Describe("SetMetadata", func() {
		var (
			metadata VMMetadata
		)

		Context("no tags found in metadata", func() {