Beispiel #1
0
				Port:     123,
			}

			spy = test_support_mocks.NewMockSpy(mockCtrl)
			startCall = mockRegistryServerManager.EXPECT().Start("fake-username", "fake-password", "fake-host", 123).Return(mockRegistryServer, nil)
			spyCall = spy.EXPECT().Record()
			stopCall = mockRegistryServer.EXPECT().Stop().Return(nil)

			logBuffer = gbytes.NewBuffer()
			goLogger := log.New(logBuffer, "", log.LstdFlags)
			logger = boshlog.New(boshlog.LevelWarn, goLogger, goLogger)
			fakeStage = fakebiui.NewFakeStage()
		})

		It("starts the registry before calling the function", func() {
			spyCall.After(startCall)

			err := newInstalation().WithRunningRegistry(logger, fakeStage, func() error {
				spy.Record()
				return nil
			})
			Expect(err).NotTo(HaveOccurred())
		})

		It("performs stages for starting and stopping the registry", func() {
			err := newInstalation().WithRunningRegistry(logger, fakeStage, func() error {
				spy.Record()
				return nil
			})
			Expect(err).NotTo(HaveOccurred())
				Name:          "fake-release-package-name-3",
				Fingerprint:   "fake-release-package-fingerprint-3",
				SHA1:          "fake-release-package-sha1-3",
				Dependencies:  []*birelpkg.Package{releasePackage1},
				ExtractedPath: "/extracted-release-path/extracted_packages/fake-release-package-name-3",
			}

			releaseJob.PackageNames = append(releaseJob.PackageNames, releasePackage3.Name)
			releaseJob.Packages = append(releaseJob.Packages, releasePackage3)
			releaseJobs = []bireljob.Job{releaseJob}
		})

		JustBeforeEach(func() {
			compiledPackageRecord3 := bistatepkg.CompiledPackageRecord{
				BlobID:   "fake-compiled-package-blobstore-id-3",
				BlobSHA1: "fake-compiled-package-sha1-3",
			}
			expectCompilePkg3 = mockPackageCompiler.EXPECT().Compile(releasePackage3).Return(compiledPackageRecord3, false, nil).AnyTimes()
		})

		It("only compiles each package once", func() {
			expectCompilePkg1.Times(1)
			expectCompilePkg2.After(expectCompilePkg1)
			expectCompilePkg3.After(expectCompilePkg1)

			_, err := dependencyCompiler.Compile(releaseJobs, fakeStage)
			Expect(err).ToNot(HaveOccurred())
		})
	})
})