本文整理汇总了Golang中github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes.FakeFileSystem类的典型用法代码示例。如果您正苦于以下问题:Golang FakeFileSystem类的具体用法?Golang FakeFileSystem怎么用?Golang FakeFileSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FakeFileSystem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1:
package disk_test
import (
"errors"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-agent/platform/disk"
fakesys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
)
var _ = Describe("procMountsSearcher", func() {
var (
fs *fakesys.FakeFileSystem
searcher MountsSearcher
)
BeforeEach(func() {
fs = fakesys.NewFakeFileSystem()
searcher = NewProcMountsSearcher(fs)
})
Describe("SearchMounts", func() {
Context("when reading /proc/mounts succeeds", func() {
It("returns parsed mount information", func() {
fs.WriteFileString(
"/proc/mounts",
`none /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
none /run/shm tmpfs rw,nosuid,nodev,relatime 0 0
/dev/sda1 /boot ext2 rw,relatime,errors=continue 0 0
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:proc_mounts_searcher_test.go
示例2:
"errors"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-init/release"
fakecmd "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/fileutil/fakes"
fakesys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
bireljob "github.com/cloudfoundry/bosh-init/release/job"
birelpkg "github.com/cloudfoundry/bosh-init/release/pkg"
)
var _ = Describe("tarReader", func() {
var (
reader Reader
fakeFs *fakesys.FakeFileSystem
compressor *fakecmd.FakeCompressor
)
BeforeEach(func() {
fakeFs = fakesys.NewFakeFileSystem()
compressor = fakecmd.NewFakeCompressor()
reader = NewReader("/some/release.tgz", "/extracted/release", fakeFs, compressor)
})
Describe("Read", func() {
Context("when the given release archive is a valid tar", func() {
Context("when the release manifest is valid", func() {
BeforeEach(func() {
fakeFs.WriteFileString(
"/extracted/release/release.MF",
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:reader_test.go
示例3:
var (
fs *fakesys.FakeFileSystem
logger boshlog.Logger
releaseManager birel.Manager
mockCpiInstaller *mock_install.MockInstaller
mockCpiUninstaller *mock_install.MockUninstaller
mockInstallerFactory *mock_install.MockInstallerFactory
mockCloudFactory *mock_cloud.MockFactory
mockReleaseExtractor *mock_release.MockExtractor
fakeUUIDGenerator *fakeuuid.FakeGenerator
setupDeploymentStateService biconfig.DeploymentStateService
fakeInstallation *fakecmd.FakeInstallation
fakeUI *fakeui.FakeUI
mockBlobstoreFactory *mock_blobstore.MockFactory
mockBlobstore *mock_blobstore.MockBlobstore
mockDeploymentManagerFactory *mock_deployment.MockManagerFactory
mockDeploymentManager *mock_deployment.MockManager
mockDeployment *mock_deployment.MockDeployment
mockAgentClient *mock_agentclient.MockAgentClient
mockAgentClientFactory *mock_httpagent.MockAgentClientFactory
mockCloud *mock_cloud.MockCloud
fakeStage *fakebiui.FakeStage
directorID string
deploymentManifestPath = "/deployment-dir/fake-deployment-manifest.yml"
deploymentStatePath string
expectCPIExtractRelease *gomock.Call
expectCPIInstall *gomock.Call
expectNewCloud *gomock.Call
mbusURL = "http://fake-mbus-user:[email protected]"
)
开发者ID:hanzhefeng,项目名称:bosh-init,代码行数:39,代码来源:deployment_deleteter_test.go
示例4: describeUbuntuNetManager
func describeUbuntuNetManager() {
var (
fs *fakesys.FakeFileSystem
cmdRunner *fakesys.FakeCmdRunner
ipResolver *fakeip.FakeResolver
addressBroadcaster *fakearp.FakeAddressBroadcaster
netManager UbuntuNetManager
interfaceConfigurationCreator InterfaceConfigurationCreator
)
writeNetworkDevice := func(iface string, macAddress string, isPhysical bool) string {
interfacePath := fmt.Sprintf("/sys/class/net/%s", iface)
fs.WriteFile(interfacePath, []byte{})
if isPhysical {
fs.WriteFile(fmt.Sprintf("/sys/class/net/%s/device", iface), []byte{})
}
fs.WriteFileString(fmt.Sprintf("/sys/class/net/%s/address", iface), fmt.Sprintf("%s\n", macAddress))
return interfacePath
}
stubInterfacesWithVirtual := func(physicalInterfaces map[string]boshsettings.Network, virtualInterfaces []string) {
interfacePaths := []string{}
for iface, networkSettings := range physicalInterfaces {
interfacePaths = append(interfacePaths, writeNetworkDevice(iface, networkSettings.Mac, true))
}
for _, iface := range virtualInterfaces {
interfacePaths = append(interfacePaths, writeNetworkDevice(iface, "virtual", false))
}
fs.SetGlob("/sys/class/net/*", interfacePaths)
}
stubInterfaces := func(physicalInterfaces map[string]boshsettings.Network) {
stubInterfacesWithVirtual(physicalInterfaces, nil)
}
BeforeEach(func() {
fs = fakesys.NewFakeFileSystem()
cmdRunner = fakesys.NewFakeCmdRunner()
ipResolver = &fakeip.FakeResolver{}
logger := boshlog.NewLogger(boshlog.LevelNone)
interfaceConfigurationCreator = NewInterfaceConfigurationCreator(logger)
addressBroadcaster = &fakearp.FakeAddressBroadcaster{}
netManager = NewUbuntuNetManager(
fs,
cmdRunner,
ipResolver,
interfaceConfigurationCreator,
addressBroadcaster,
logger,
).(UbuntuNetManager)
})
Describe("ComputeNetworkConfig", func() {
Context("when there is one manual network and neither is marked as default for DNS", func() {
It("should use the manual network for DNS", func() {
networks := boshsettings.Networks{
"manual": factory.Network{DNS: &[]string{"8.8.8.8"}}.Build(),
}
stubInterfaces(networks)
_, _, dnsServers, err := netManager.ComputeNetworkConfig(networks)
Expect(err).ToNot(HaveOccurred())
Expect(dnsServers).To(Equal([]string{"8.8.8.8"}))
})
})
Context("when there is a vip network and a manual network and neither is marked as default for DNS", func() {
It("should use the manual network for DNS", func() {
networks := boshsettings.Networks{
"vip": boshsettings.Network{Type: "vip"},
"manual": factory.Network{Type: "manual", DNS: &[]string{"8.8.8.8"}}.Build(),
}
stubInterfaces(networks)
_, _, dnsServers, err := netManager.ComputeNetworkConfig(networks)
Expect(err).ToNot(HaveOccurred())
Expect(dnsServers).To(Equal([]string{"8.8.8.8"}))
})
})
Context("when there is a vip network and a manual network and the manual network is marked as default for DNS", func() {
It("should use the manual network for DNS", func() {
networks := boshsettings.Networks{
"vip": boshsettings.Network{Type: "vip"},
"manual": factory.Network{Type: "manual", DNS: &[]string{"8.8.8.8"}, Default: []string{"dns"}}.Build(),
}
stubInterfaces(networks)
_, _, dnsServers, err := netManager.ComputeNetworkConfig(networks)
Expect(err).ToNot(HaveOccurred())
Expect(dnsServers).To(Equal([]string{"8.8.8.8"}))
})
})
Context("when specified more than one DNS", func() {
It("extracts all DNS servers from the network configured as default DNS", func() {
networks := boshsettings.Networks{
"default": factory.Network{
IP: "10.10.0.32",
Netmask: "255.255.255.0",
//.........这里部分代码省略.........
开发者ID:vestel,项目名称:bosh-init,代码行数:101,代码来源:ubuntu_net_manager_test.go
示例5:
var (
fs *fakesys.FakeFileSystem
logger boshlog.Logger
registryServerManager biregistry.ServerManager
releaseManager birel.Manager
mockInstaller *mock_install.MockInstaller
mockInstallerFactory *mock_install.MockInstallerFactory
mockCloudFactory *mock_cloud.MockFactory
mockCloud *mock_cloud.MockCloud
mockAgentClient *mock_agentclient.MockAgentClient
mockAgentClientFactory *mock_httpagent.MockAgentClientFactory
mockReleaseExtractor *mock_release.MockExtractor
mockStateBuilderFactory *mock_instance_state.MockBuilderFactory
mockStateBuilder *mock_instance_state.MockBuilder
mockState *mock_instance_state.MockState
mockBlobstoreFactory *mock_blobstore.MockFactory
mockBlobstore *mock_blobstore.MockBlobstore
fakeStemcellExtractor *fakebistemcell.FakeExtractor
fakeUUIDGenerator *fakeuuid.FakeGenerator
fakeRegistryUUIDGenerator *fakeuuid.FakeGenerator
fakeRepoUUIDGenerator *fakeuuid.FakeGenerator
fakeAgentIDGenerator *fakeuuid.FakeGenerator
fakeSHA1Calculator *fakebicrypto.FakeSha1Calculator
legacyDeploymentStateMigrator biconfig.LegacyDeploymentStateMigrator
deploymentStateService biconfig.DeploymentStateService
vmRepo biconfig.VMRepo
diskRepo biconfig.DiskRepo
stemcellRepo biconfig.StemcellRepo
deploymentRepo biconfig.DeploymentRepo
releaseRepo biconfig.ReleaseRepo
sshTunnelFactory bisshtunnel.Factory
diskManagerFactory bidisk.ManagerFactory
diskDeployer bivm.DiskDeployer
stdOut *gbytes.Buffer
stdErr *gbytes.Buffer
fakeStage *fakebiui.FakeStage
stemcellManagerFactory bistemcell.ManagerFactory
vmManagerFactory bivm.ManagerFactory
applySpec bias.ApplySpec
directorID string
stemcellTarballPath = "/fake-stemcell-release.tgz"
deploymentManifestPath = "/deployment-dir/fake-deployment-manifest.yml"
deploymentStatePath = "/deployment-dir/fake-deployment-manifest-state.json"
stemcellImagePath = "fake-stemcell-image-path"
stemcellCID = "fake-stemcell-cid"
stemcellCloudProperties = biproperty.Map{}
vmCloudProperties = biproperty.Map{}
vmEnv = biproperty.Map{}
diskCloudProperties = biproperty.Map{}
networkInterfaces = map[string]biproperty.Map{
"network-1": biproperty.Map{
"type": "dynamic",
"default": []bideplmanifest.NetworkDefault{"dns", "gateway"},
"cloud_properties": biproperty.Map{},
},
}
agentRunningState = biagentclient.AgentState{JobState: "running"}
mbusURL = "http://fake-mbus-url"
expectHasVM1 *gomock.Call
expectDeleteVM1 *gomock.Call
sshConfig *SSHConfig
)
开发者ID:vestel,项目名称:bosh-init,代码行数:81,代码来源:deploy_test.go
示例6:
package release_test
import (
fakesys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
bireljob "github.com/cloudfoundry/bosh-init/release/job"
birelpkg "github.com/cloudfoundry/bosh-init/release/pkg"
. "github.com/cloudfoundry/bosh-init/release"
)
var _ = Describe("Release", func() {
var (
release Release
expectedJob bireljob.Job
fakeFS *fakesys.FakeFileSystem
)
BeforeEach(func() {
expectedJob = bireljob.Job{
Name: "fake-job-name",
}
fakeFS = fakesys.NewFakeFileSystem()
release = NewRelease(
"fake-release-name",
"fake-release-version",
[]bireljob.Job{expectedJob},
[]*birelpkg.Package{},
"fake-extracted-path",
fakeFS,
开发者ID:hanzhefeng,项目名称:bosh-init,代码行数:31,代码来源:release_test.go
示例7:
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
bireljob "github.com/cloudfoundry/bosh-init/release/job"
bierbrenderer "github.com/cloudfoundry/bosh-init/templatescompiler/erbrenderer"
fakebirender "github.com/cloudfoundry/bosh-init/templatescompiler/erbrenderer/fakes"
. "github.com/cloudfoundry/bosh-init/templatescompiler"
)
var _ = Describe("JobRenderer", func() {
var (
jobRenderer JobRenderer
fakeERBRenderer *fakebirender.FakeERBRenderer
job bireljob.Job
context bierbrenderer.TemplateEvaluationContext
fs *fakesys.FakeFileSystem
jobProperties biproperty.Map
globalProperties biproperty.Map
srcPath string
dstPath string
)
BeforeEach(func() {
srcPath = "fake-src-path"
dstPath = "fake-dst-path"
jobProperties = biproperty.Map{
"fake-property-key": "fake-job-property-value",
}
globalProperties = biproperty.Map{
"fake-property-key": "fake-global-property-value",
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:job_renderer_test.go
示例8:
import (
"errors"
biindex "github.com/cloudfoundry/bosh-init/index"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
birelpkg "github.com/cloudfoundry/bosh-init/release/pkg"
fakesys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
. "github.com/cloudfoundry/bosh-init/state/pkg"
)
var _ = Describe("CompiledPackageRepo", func() {
var (
index biindex.Index
compiledPackageRepo CompiledPackageRepo
fakeFS *fakesys.FakeFileSystem
)
BeforeEach(func() {
fakeFS = fakesys.NewFakeFileSystem()
index = biindex.NewFileIndex("/index_file", fakeFS)
compiledPackageRepo = NewCompiledPackageRepo(index)
})
Context("Save and Find", func() {
var (
record CompiledPackageRecord
dependency birelpkg.Package
pkg birelpkg.Package
)
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:compiled_package_repo_test.go
示例9:
import (
"encoding/json"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
boshsettings "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-agent/settings"
fakesys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
. "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-agent/infrastructure"
)
var _ = Describe("FileRegistry", func() {
var (
fs *fakesys.FakeFileSystem
fileRegistry Registry
)
BeforeEach(func() {
fs = fakesys.NewFakeFileSystem()
fileRegistry = NewFileRegistry("/fake-registry-file-path", fs)
})
Describe("GetSettings", func() {
Context("when the registry file exists", func() {
var (
expectedSettings boshsettings.Settings
)
BeforeEach(func() {
expectedSettings = boshsettings.Settings{
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:file_registry_test.go
示例10:
package crypto_test
import (
"errors"
"os"
. "github.com/cloudfoundry/bosh-init/crypto"
fakesys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
)
var _ = Describe("Sha1Calculator", func() {
var (
fs *fakesys.FakeFileSystem
sha1Calculator SHA1Calculator
)
BeforeEach(func() {
fs = fakesys.NewFakeFileSystem()
sha1Calculator = NewSha1Calculator(fs)
})
Describe("Calculate", func() {
Context("when path is directory", func() {
BeforeEach(func() {
fs.RegisterOpenFile("/fake-templates-dir", &fakesys.FakeFile{
Stats: &fakesys.FakeFileStats{FileType: fakesys.FakeFileTypeDir},
})
fs.RegisterOpenFile("/fake-templates-dir/file-1", &fakesys.FakeFile{
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:sha1_calculator_test.go
示例11:
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
boshdevutil "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-agent/platform/deviceutil"
fakedisk "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-agent/platform/disk/fakes"
boshlog "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/logger"
fakesys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
. "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-agent/platform/disk"
)
var _ = Describe("Diskutil", func() {
var (
diskUtil boshdevutil.DeviceUtil
mounter *fakedisk.FakeMounter
fs *fakesys.FakeFileSystem
)
BeforeEach(func() {
mounter = &fakedisk.FakeMounter{}
fs = fakesys.NewFakeFileSystem()
logger := boshlog.NewLogger(boshlog.LevelNone)
diskUtil = NewDiskUtil("fake-disk-path", mounter, fs, logger)
})
Describe("GetFileContents", func() {
Context("when disk path does not exist", func() {
It("returns an error if diskpath does not exist", func() {
_, err := diskUtil.GetFilesContents([]string{"fake-file-path-1"})
Expect(err).To(HaveOccurred())
开发者ID:vestel,项目名称:bosh-init,代码行数:30,代码来源:diskutil_test.go
示例12:
import (
"errors"
boshlog "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/logger"
boshsys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system"
fakesys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-init/templatescompiler/erbrenderer"
fakebierbrenderer "github.com/cloudfoundry/bosh-init/templatescompiler/erbrenderer/fakes"
)
var _ = Describe("ErbRenderer", func() {
var (
fs *fakesys.FakeFileSystem
runner *fakesys.FakeCmdRunner
erbRenderer ERBRenderer
context *fakebierbrenderer.FakeTemplateEvaluationContext
)
BeforeEach(func() {
logger := boshlog.NewLogger(boshlog.LevelNone)
fs = fakesys.NewFakeFileSystem()
runner = fakesys.NewFakeCmdRunner()
context = &fakebierbrenderer.FakeTemplateEvaluationContext{}
erbRenderer = NewERBRenderer(fs, runner, logger)
fs.TempDirDir = "fake-temp-dir"
})
It("constructs ruby erb rendering command", func() {
err := erbRenderer.Render("fake-src-path", "fake-dst-path", context)
开发者ID:vestel,项目名称:bosh-init,代码行数:32,代码来源:erb_renderer_test.go
示例13:
boshlog "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/logger"
fakesys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
birelmanifest "github.com/cloudfoundry/bosh-init/release/manifest"
"github.com/cloudfoundry/bosh-init/release/set/manifest"
"github.com/cloudfoundry/bosh-init/release/set/manifest/fakes"
)
var _ = Describe("Parser", func() {
comboManifestPath := "/path/to/manifest/fake-deployment-manifest"
var (
fakeFs *fakesys.FakeFileSystem
parser manifest.Parser
fakeValidator *fakes.FakeValidator
)
BeforeEach(func() {
fakeFs = fakesys.NewFakeFileSystem()
logger := boshlog.NewLogger(boshlog.LevelNone)
fakeValidator = fakes.NewFakeValidator()
fakeValidator.SetValidateBehavior([]fakes.ValidateOutput{
{Err: nil},
})
parser = manifest.NewParser(fakeFs, logger, fakeValidator)
fakeFs.WriteFileString(comboManifestPath, `
---
releases:
- name: fake-release-name-1
开发者ID:vestel,项目名称:bosh-init,代码行数:30,代码来源:parser_test.go
示例14:
})
It("returns an empty slice for an empty string", func() {
result := cert.SplitCerts("")
Expect(len(result)).To(Equal(0))
})
It("returns an empty slice for an non-empty string that does not contain any certificates", func() {
result := cert.SplitCerts("abcdefghij")
Expect(len(result)).To(Equal(0))
})
})
Describe("DeleteFile()", func() {
var (
fakeFs *fakesys.FakeFileSystem
)
BeforeEach(func() {
fakeFs = fakesys.NewFakeFileSystem()
})
It("only deletes the files with the given prefix", func() {
fakeFs.WriteFileString("/path/to/delete/stuff/in/delete_me_1.foo", "goodbye")
fakeFs.WriteFileString("/path/to/delete/stuff/in/delete_me_2.foo", "goodbye")
fakeFs.WriteFileString("/path/to/delete/stuff/in/different_file_1.bar", "goodbye")
fakeFs.SetGlob("/path/to/delete/stuff/in/delete_me_*", []string{
"/path/to/delete/stuff/in/delete_me_1.foo",
"/path/to/delete/stuff/in/delete_me_2.foo",
})
count, err := cert.DeleteFiles(fakeFs, "/path/to/delete/stuff/in/", "delete_me_")
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:cert_manager_test.go
示例15:
package infrastructure_test
import (
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-agent/infrastructure"
boshsettings "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-agent/settings"
boshlog "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/logger"
fakesys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
)
var _ = Describe("FileMetadataService", func() {
var (
fs *fakesys.FakeFileSystem
metadataService MetadataService
)
BeforeEach(func() {
fs = fakesys.NewFakeFileSystem()
logger := boshlog.NewLogger(boshlog.LevelNone)
metadataService = NewFileMetadataService(
"fake-metadata-file-path",
"fake-userdata-file-path",
"fake-settings-file-path",
fs,
logger,
)
})
Describe("GetInstanceID", func() {
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:file_metadata_service_test.go
示例16:
bosherr "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/errors"
fakecmd "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/fileutil/fakes"
boshlog "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/logger"
fakesys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
bireljob "github.com/cloudfoundry/bosh-init/release/job"
birelpkg "github.com/cloudfoundry/bosh-init/release/pkg"
fakebirel "github.com/cloudfoundry/bosh-init/release/fakes"
)
var _ = Describe("Extractor", func() {
var (
fakeFS *fakesys.FakeFileSystem
compressor *fakecmd.FakeCompressor
fakeReleaseValidator *fakebirel.FakeValidator
releaseExtractor Extractor
)
BeforeEach(func() {
fakeFS = fakesys.NewFakeFileSystem()
compressor = fakecmd.NewFakeCompressor()
fakeReleaseValidator = fakebirel.NewFakeValidator()
logger := boshlog.NewLogger(boshlog.LevelNone)
releaseExtractor = NewExtractor(fakeFS, compressor, fakeReleaseValidator, logger)
})
Describe("Extract", func() {
var (
releaseTarballPath string
)
开发者ID:hanzhefeng,项目名称:bosh-init,代码行数:31,代码来源:extractor_test.go
示例17:
var mockCtrl *gomock.Controller
BeforeEach(func() {
mockCtrl = gomock.NewController(GinkgoT())
})
AfterEach(func() {
mockCtrl.Finish()
})
Describe("Run", func() {
var (
mockDeploymentDeleter *mock_cmd.MockDeploymentDeleter
fs *fakesys.FakeFileSystem
logger boshlog.Logger
fakeUI *fakeui.FakeUI
fakeStage *fakebiui.FakeStage
deploymentManifestPath = "/deployment-dir/fake-deployment-manifest.yml"
)
var newDeleteCmd = func() bicmd.Cmd {
doGetFunc := func(deploymentManifestPath string) (bicmd.DeploymentDeleter, error) {
Expect(deploymentManifestPath).To(Equal(deploymentManifestPath))
return mockDeploymentDeleter, nil
}
return bicmd.NewDeleteCmd(fakeUI, fs, logger, doGetFunc)
}
var writeDeploymentManifest = func() {
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:delete_cmd_test.go
示例18: expectedLogFormat
. "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/logger/file"
boshlog "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/logger"
boshsys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system"
fakeboshsys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
)
func expectedLogFormat(tag, msg string) string {
return fmt.Sprintf("\\[%s\\] [0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} %s\n", tag, msg)
}
var _ = Describe("NewFileLogger", func() {
var (
fs *fakeboshsys.FakeFileSystem
logFile boshsys.File
)
BeforeEach(func() {
fs = fakeboshsys.NewFakeFileSystem()
var err error
logFile, err = fs.TempFile("file-logger-test")
Expect(err).ToNot(HaveOccurred())
err = logFile.Close()
Expect(err).ToNot(HaveOccurred())
})
AfterEach(func() {
logFile.Close()
fs.RemoveAll(logFile.Name())
})
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:file_test.go
示例19:
bidisk "github.com/cloudfoundry/bosh-init/deployment/disk"
bideplmanifest "github.com/cloudfoundry/bosh-init/deployment/manifest"
boshlog "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/logger"
biproperty "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/property"
fakesys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
fakeuuid "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/uuid/fakes"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
fakebiui "github.com/cloudfoundry/bosh-init/ui/fakes"
)
var _ = Describe("Manager", func() {
var (
manager Manager
fakeCloud *fakebicloud.FakeCloud
fakeFs *fakesys.FakeFileSystem
fakeUUIDGenerator *fakeuuid.FakeGenerator
diskRepo biconfig.DiskRepo
)
BeforeEach(func() {
logger := boshlog.NewLogger(boshlog.LevelNone)
fakeFs = fakesys.NewFakeFileSystem()
fakeUUIDGenerator = &fakeuuid.FakeGenerator{}
deploymentStateService := biconfig.NewFileSystemDeploymentStateService(fakeFs, fakeUUIDGenerator, logger, "/fake/path")
diskRepo = biconfig.NewDiskRepo(deploymentStateService, fakeUUIDGenerator)
managerFactory := NewManagerFactory(diskRepo, logger)
fakeCloud = fakebicloud.NewFakeCloud()
manager = managerFactory.NewManager(fakeCloud)
fakeUUIDGenerator.GeneratedUUID = "fake-uuid"
})
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:manager_test.go
示例20:
package tarball_test
import (
. "github.com/cloudfoundry/bosh-init/installation/tarball"
boshlog "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/logger"
fakesys "github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-init/internal/github.com/onsi/gomega"
)
var _ = Describe("Cache", func() {
var (
cache Cache
fs *fakesys.FakeFileSystem
)
BeforeEach(func() {
logger := boshlog.NewLogger(boshlog.LevelNone)
fs = fakesys.NewFakeFileSystem()
cache = NewCache(
"/fake-base-path",
fs,
logger,
)
})
It("is a cache hit when the tarball with that url and sha1 has been downloaded", func() {
fs.WriteFileString("source-path", "")
err := cache.Save("source-path", &fakeSource{
sha1: "fake-sha1",
开发者ID:vestel,项目名称:bosh-init,代码行数:31,代码来源:cache_test.go
注:本文中的github.com/cloudfoundry/bosh-init/internal/github.com/cloudfoundry/bosh-utils/system/fakes.FakeFileSystem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论