Esempio n. 1
0
func NewProvider(
	platform boshplatform.Platform,
	dirProvider boshdir.DirectoriesProvider,
	logger boshlog.Logger,
) (p Provider) {
	p.uuidGen = boshuuid.NewGenerator()
	p.platform = platform
	p.dirProvider = dirProvider
	p.logger = logger
	return
}
Esempio n. 2
0
func basicDeps(debug bool) (boshlog.Logger, boshsys.FileSystem, boshsys.CmdRunner, boshuuid.Generator) {
	logLevel := boshlog.LevelInfo

	// Debug generates a lot of log activity
	if debug {
		logLevel = boshlog.LevelDebug
	}

	logger := boshlog.NewWriterLogger(logLevel, os.Stderr, os.Stderr)
	fs := boshsys.NewOsFileSystem(logger)
	runner := boshsys.NewExecCmdRunner(logger)
	uuidGen := boshuuid.NewGenerator()
	return logger, fs, runner, uuidGen
}
func buildPkg(bc *fakebc.FakeBundleCollection) (models.Package, *fakebc.FakeBundle) {
	uuidGen := boshuuid.NewGenerator()
	uuid, err := uuidGen.Generate()
	Expect(err).ToNot(HaveOccurred())

	pkg := models.Package{
		Name:    "fake-package-name" + uuid,
		Version: "fake-package-name",
		Source: models.Source{
			Sha1:        "fake-blob-sha1",
			BlobstoreID: "fake-blobstore-id",
		},
	}

	bundle := bc.FakeGet(pkg)

	return pkg, bundle
}
func buildJob(bc *fakebc.FakeBundleCollection) (models.Job, *fakebc.FakeBundle) {
	uuidGen := boshuuid.NewGenerator()
	uuid, err := uuidGen.Generate()
	Expect(err).ToNot(HaveOccurred())

	job := models.Job{
		Name:    "fake-job-name" + uuid,
		Version: "fake-job-version",
		Source: models.Source{
			Sha1:          "fake-blob-sha1",
			BlobstoreID:   "fake-blobstore-id",
			PathInArchive: "fake-path-in-archive",
		},
		Packages: []models.Package{
			models.Package{
				Name:    "fake-package1-name" + uuid,
				Version: "fake-package1-version",
				Source: models.Source{
					Sha1:          "fake-package1-sha1",
					BlobstoreID:   "fake-package1-blobstore-id",
					PathInArchive: "",
				},
			},
			models.Package{
				Name:    "fake-package2-name" + uuid,
				Version: "fake-package2-version",
				Source: models.Source{
					Sha1:          "fake-package2-sha1",
					BlobstoreID:   "fake-package2-blobstore-id",
					PathInArchive: "",
				},
			},
		},
	}

	bundle := bc.FakeGet(job)

	return job, bundle
}
Esempio n. 5
0
			options := map[string]interface{}{"key": "value"}

			platform.Runner.CommandExistsValue = true

			blobstore, err := provider.Get(boshsettings.Blobstore{
				Type:    "fake-external-type",
				Options: options,
			})
			Expect(err).ToNot(HaveOccurred())

			expectedBlobstore := NewExternalBlobstore(
				"fake-external-type",
				options,
				platform.GetFs(),
				platform.GetRunner(),
				boshuuid.NewGenerator(),
				"/var/vcap/bosh/etc/blobstore-fake-external-type.json",
			)
			expectedBlobstore = NewSHA1VerifiableBlobstore(expectedBlobstore)
			expectedBlobstore = NewRetryableBlobstore(expectedBlobstore, 3, logger)
			Expect(blobstore).To(Equal(expectedBlobstore))

			err = expectedBlobstore.Validate()
			Expect(err).ToNot(HaveOccurred())
		})

		It("get external errs when external command not in path", func() {
			options := map[string]interface{}{"key": "value"}

			platform.Runner.CommandExistsValue = false
func buildPackage() models.Package {
	uuidGen := boshuuid.NewGenerator()
	uuid, err := uuidGen.Generate()
	Expect(err).ToNot(HaveOccurred())
	return models.Package{Name: "fake-package-name" + uuid, Version: "fake-package-name"}
}
func buildJob() models.Job {
	uuidGen := boshuuid.NewGenerator()
	uuid, err := uuidGen.Generate()
	Expect(err).ToNot(HaveOccurred())
	return models.Job{Name: "fake-job-name" + uuid, Version: "fake-version-name"}
}