本文整理匯總了Golang中bosh/settings/directories.NewDirectoriesProvider函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewDirectoriesProvider函數的具體用法?Golang NewDirectoriesProvider怎麽用?Golang NewDirectoriesProvider使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewDirectoriesProvider函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: buildMigrateDiskAction
func buildMigrateDiskAction() (platform *fakeplatform.FakePlatform, action migrateDiskAction) {
platform = fakeplatform.NewFakePlatform()
settings := &fakesettings.FakeSettingsService{}
dirProvider := boshdirs.NewDirectoriesProvider("/foo")
action = newMigrateDisk(settings, platform, dirProvider)
return
}
示例2: getNewProvider
func getNewProvider() (provider provider) {
dirProvider := boshsys.NewDirectoriesProvider("/var/vcap")
fs := fakefs.NewFakeFileSystem()
provider = NewProvider(boshlog.NewLogger(boshlog.LEVEL_NONE), fs, dirProvider)
return
}
示例3: createBlobManager
func createBlobManager() (blobManager BlobManager, fs *fakesys.FakeFileSystem) {
fs = fakesys.NewFakeFileSystem()
dirProvider := boshdir.NewDirectoriesProvider("/var/vcap")
blobManager = NewBlobManager(fs, dirProvider)
return
}
示例4: buildCompiler
func buildCompiler() (
deps compilerDeps,
compiler Compiler,
) {
deps.compressor = fakecmd.NewFakeCompressor()
deps.blobstore = &fakeblobstore.FakeBlobstore{}
deps.fs = fakesys.NewFakeFileSystem()
deps.runner = fakesys.NewFakeCmdRunner()
deps.packageApplier = fakepa.NewFakePackageApplier()
fakeBundleCollection := fakebc.NewFakeBundleCollection()
bundleDefinition := boshmodels.Package{
Name: "pkg_name",
Version: "pkg_version",
}
deps.bundle = fakeBundleCollection.FakeGet(bundleDefinition)
deps.bundle.InstallPath = "/fake-dir/data/packages/pkg_name/pkg_version"
deps.bundle.EnablePath = "/fake-dir/packages/pkg_name"
deps.packagesBc = fakeBundleCollection
compiler = NewConcreteCompiler(
deps.compressor,
deps.blobstore,
deps.fs,
deps.runner,
boshdirs.NewDirectoriesProvider("/fake-dir"),
deps.packageApplier,
deps.packagesBc,
)
return
}
示例5: buildFactory
func buildFactory() (
deps concreteFactoryDependencies,
factory Factory) {
deps.settings = &fakesettings.FakeSettingsService{}
deps.platform = fakeplatform.NewFakePlatform()
deps.blobstore = &fakeblobstore.FakeBlobstore{}
deps.taskService = &faketask.FakeService{}
deps.notifier = fakenotif.NewFakeNotifier()
deps.applier = fakeappl.NewFakeApplier()
deps.compiler = fakecomp.NewFakeCompiler()
deps.monitor = fakemon.NewFakeMonitor()
deps.specService = fakeas.NewFakeV1Service()
deps.dirProvider = boshdirs.NewDirectoriesProvider("/foo")
deps.drainScriptProvider = boshdrain.NewDrainScriptProvider(nil, nil, deps.dirProvider)
factory = NewFactory(
deps.settings,
deps.platform,
deps.blobstore,
deps.taskService,
deps.notifier,
deps.applier,
deps.compiler,
deps.monitor,
deps.specService,
deps.dirProvider,
deps.drainScriptProvider,
)
return
}
示例6: TestHandlerProviderGetReturnsConcreteProvider
func TestHandlerProviderGetReturnsConcreteProvider(t *testing.T) {
platform := fakeplatform.NewFakePlatform()
blobstore := fakeblob.NewFakeBlobstore()
jobSupervisor := fakejobsuper.NewFakeJobSupervisor()
expectedPackageApplier := pa.NewConcretePackageApplier(
bc.NewFileBundleCollection("/fake-base-dir/data", "/fake-base-dir", "packages", platform.GetFs()),
blobstore,
platform.GetCompressor(),
)
expectedJobApplier := ja.NewRenderedJobApplier(
bc.NewFileBundleCollection("/fake-base-dir/data", "/fake-base-dir", "jobs", platform.GetFs()),
blobstore,
platform.GetCompressor(),
jobSupervisor,
)
dirProvider := boshdirs.NewDirectoriesProvider("/fake-base-dir")
expectedApplier := NewConcreteApplier(
expectedJobApplier,
expectedPackageApplier,
platform,
jobSupervisor,
dirProvider,
)
provider := NewApplierProvider(platform, blobstore, jobSupervisor, dirProvider)
applier := provider.Get()
assert.Equal(t, expectedApplier, applier)
}
示例7: buildLogsAction
func buildLogsAction() (*fakecmd.FakeCompressor, *fakeblobstore.FakeBlobstore, logsAction) {
compressor := fakecmd.NewFakeCompressor()
blobstore := &fakeblobstore.FakeBlobstore{}
dirProvider := boshdirs.NewDirectoriesProvider("/fake/dir")
action := newLogs(compressor, blobstore, dirProvider)
return compressor, blobstore, action
}
示例8: getExternalBlobstoreDependencies
func getExternalBlobstoreDependencies() (fs *fakesys.FakeFileSystem, runner *fakesys.FakeCmdRunner, uuidGen *fakeuuid.FakeGenerator, configPath string) {
fs = &fakesys.FakeFileSystem{}
runner = &fakesys.FakeCmdRunner{}
uuidGen = &fakeuuid.FakeGenerator{}
dirProvider := boshdir.NewDirectoriesProvider("/var/vcap")
configPath = filepath.Join(dirProvider.EtcDir(), "blobstore-fake-provider.json")
return
}
示例9: getBootstrapDependencies
func getBootstrapDependencies() (inf *fakeinf.FakeInfrastructure, platform *fakeplatform.FakePlatform, dirProvider boshdir.DirectoriesProvider) {
inf = &fakeinf.FakeInfrastructure{}
inf.GetEphemeralDiskPathFound = true
inf.GetEphemeralDiskPathRealPath = "/dev/sdz"
platform = fakeplatform.NewFakePlatform()
dirProvider = boshdir.NewDirectoriesProvider("/var/vcap")
return
}
示例10: init
func init() {
Describe("dummyInfrastructure", func() {
It("get settings", func() {
fs := fakefs.NewFakeFileSystem()
dirProvider := boshdir.NewDirectoriesProvider("/var/vcap")
platform := fakeplatform.NewFakePlatform()
fakeDevicePathResolver := fakedpresolv.NewFakeDevicePathResolver(1*time.Millisecond, platform.GetFs())
settingsPath := filepath.Join(dirProvider.BoshDir(), "dummy-cpi-agent-env.json")
expectedSettings := boshsettings.Settings{
AgentID: "123-456-789",
Blobstore: boshsettings.Blobstore{
Type: boshsettings.BlobstoreTypeDummy,
},
Mbus: "nats://127.0.0.1:4222",
}
existingSettingsBytes, _ := json.Marshal(expectedSettings)
fs.WriteFile(settingsPath, existingSettingsBytes)
dummy := NewDummyInfrastructure(fs, dirProvider, platform, fakeDevicePathResolver)
settings, err := dummy.GetSettings()
Expect(err).ToNot(HaveOccurred())
assert.Equal(GinkgoT(), settings, boshsettings.Settings{
AgentID: "123-456-789",
Blobstore: boshsettings.Blobstore{Type: boshsettings.BlobstoreTypeDummy},
Mbus: "nats://127.0.0.1:4222",
})
})
It("get settings errs when settings file does not exist", func() {
fs := fakefs.NewFakeFileSystem()
dirProvider := boshdir.NewDirectoriesProvider("/var/vcap")
platform := fakeplatform.NewFakePlatform()
fakeDevicePathResolver := fakedpresolv.NewFakeDevicePathResolver(1*time.Millisecond, platform.GetFs())
dummy := NewDummyInfrastructure(fs, dirProvider, platform, fakeDevicePathResolver)
_, err := dummy.GetSettings()
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("Read settings file"))
})
})
}
示例11: buildProvider
func buildProvider(mbusUrl string) (deps providerDeps, provider MbusHandlerProvider) {
deps.settings = &fakesettings.FakeSettingsService{MbusUrl: mbusUrl}
deps.logger = boshlog.NewLogger(boshlog.LEVEL_NONE)
provider = NewHandlerProvider(deps.settings, deps.logger)
deps.platform = fakeplatform.NewFakePlatform()
deps.dirProvider = boshdir.NewDirectoriesProvider("/var/vcap")
return
}
示例12: buildProvider
func buildProvider(mbusUrl string) (provider mbusHandlerProvider, platform *fakeplatform.FakePlatform, dirProvider boshdir.DirectoriesProvider) {
settings := &fakesettings.FakeSettingsService{MbusUrl: mbusUrl}
logger := boshlog.NewLogger(boshlog.LEVEL_NONE)
provider = NewHandlerProvider(settings, logger)
platform = fakeplatform.NewFakePlatform()
dirProvider = boshdir.NewDirectoriesProvider("/var/vcap")
return
}
示例13: TestGetSettingsErrsWhenSettingsFileDoesNotExist
func TestGetSettingsErrsWhenSettingsFileDoesNotExist(t *testing.T) {
fs := fakefs.NewFakeFileSystem()
dirProvider := boshdir.NewDirectoriesProvider("/var/vcap")
dummy := newDummyInfrastructure(fs, dirProvider)
_, err := dummy.GetSettings()
assert.Error(t, err)
assert.Contains(t, err.Error(), "Read settings file")
}
示例14: TestNewDrainScript
func TestNewDrainScript(t *testing.T) {
runner := fakesys.NewFakeCmdRunner()
fs := fakesys.NewFakeFileSystem()
dirProvider := boshdir.NewDirectoriesProvider("/var/vcap")
scriptProvider := NewConcreteDrainScriptProvider(runner, fs, dirProvider)
drainScript := scriptProvider.NewDrainScript("foo")
assert.Equal(t, drainScript.Path(), "/var/vcap/jobs/foo/bin/drain")
}
示例15: buildService
func buildService(NTPData string) (service Service) {
fs := fakefs.NewFakeFileSystem()
dirProvider := boshdir.NewDirectoriesProvider("/var/vcap")
if NTPData != "" {
fs.WriteToFile("/var/vcap/bosh/log/ntpdate.out", NTPData)
}
service = NewConcreteService(fs, dirProvider)
return
}