本文整理汇总了Golang中github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes.FakeCmdRunner类的典型用法代码示例。如果您正苦于以下问题:Golang FakeCmdRunner类的具体用法?Golang FakeCmdRunner怎么用?Golang FakeCmdRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FakeCmdRunner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1:
/dev/sda3 : start= xxxx, size= xxxx, Id=83
/dev/sda4 : start= 0, size= 0, Id= 0
`
const devSdaSfdiskDumpOnePartition = `# partition table of /dev/sda
unit: sectors
/dev/sda1 : start= 1, size= xxxx, Id=83
/dev/sda2 : start= xxxx, size= xxxx, Id=83
/dev/sda3 : start= 0, size= 0, Id= 0
/dev/sda4 : start= 0, size= 0, Id= 0
`
var _ = Describe("sfdiskPartitioner", func() {
var (
runner *fakesys.FakeCmdRunner
partitioner Partitioner
)
BeforeEach(func() {
runner = fakesys.NewFakeCmdRunner()
logger := boshlog.NewLogger(boshlog.LevelNone)
partitioner = NewSfdiskPartitioner(logger, runner)
})
It("sfdisk partition", func() {
runner.AddCmdResult("sfdisk -d /dev/sda", fakesys.FakeCmdResult{Stdout: devSdaSfdiskEmptyDump})
partitions := []Partition{
{Type: PartitionTypeSwap, SizeInBytes: 512 * 1024 * 1024},
{Type: PartitionTypeLinux, SizeInBytes: 1024 * 1024 * 1024},
开发者ID:viovanov,项目名称:bosh-agent,代码行数:32,代码来源:sfdisk_partitioner_test.go
示例2:
import (
"errors"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"
boshretry "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/retrystrategy"
fakesys "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
. "github.com/cloudfoundry/bosh-agent/platform"
)
var _ = Describe("MonitRetryable", func() {
var (
cmdRunner *fakesys.FakeCmdRunner
monitRetryable boshretry.Retryable
)
BeforeEach(func() {
cmdRunner = fakesys.NewFakeCmdRunner()
monitRetryable = NewMonitRetryable(cmdRunner)
})
Describe("Attempt", func() {
Context("when starting monit fails", func() {
BeforeEach(func() {
cmdRunner.AddCmdResult("sv start monit", fakesys.FakeCmdResult{
ExitStatus: 255,
Error: errors.New("fake-start-monit-error"),
})
})
开发者ID:viovanov,项目名称:bosh-agent,代码行数:31,代码来源:monit_retryable_test.go
示例3:
package infrastructure_test
import (
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-agent/infrastructure"
boshlog "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/logger"
fakesys "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
)
var _ = Describe("DigDNSResolver", func() {
var (
resolver DigDNSResolver
runner *fakesys.FakeCmdRunner
)
BeforeEach(func() {
logger := boshlog.NewLogger(boshlog.LevelNone)
runner = fakesys.NewFakeCmdRunner()
resolver = NewDigDNSResolver(runner, logger)
})
Describe("LookupHost", func() {
Context("when host is an ip", func() {
It("lookup host with an ip", func() {
ip, err := resolver.LookupHost([]string{"8.8.8.8"}, "74.125.239.101")
Expect(err).ToNot(HaveOccurred())
Expect(runner.RunCommands).To(BeEmpty())
Expect(ip).To(Equal("74.125.239.101"))
})
开发者ID:viovanov,项目名称:bosh-agent,代码行数:31,代码来源:dig_dns_resolver_test.go
示例4: JobChange
jobNextState string
jobNextStateErr error
}
func (p fakeParams) JobChange() (change string) { return p.jobChange }
func (p fakeParams) HashChange() (change string) { return p.hashChange }
func (p fakeParams) UpdatedPackages() (pkgs []string) { return p.updatedPackages }
func (p fakeParams) JobState() (string, error) { return p.jobState, p.jobStateErr }
func (p fakeParams) JobNextState() (string, error) { return p.jobNextState, p.jobNextStateErr }
var _ = Describe("ConcreteScript", func() {
var (
runner *fakesys.FakeCmdRunner
fs *fakesys.FakeFileSystem
script ConcreteScript
)
BeforeEach(func() {
fs = fakesys.NewFakeFileSystem()
runner = fakesys.NewFakeCmdRunner()
script = NewConcreteScript(fs, runner, "/fake/script")
})
Describe("Run", func() {
var (
params fakeParams
)
BeforeEach(func() {
开发者ID:viovanov,项目名称:bosh-agent,代码行数:30,代码来源:concrete_script_test.go
示例5:
package disk_test
import (
"errors"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"
fakesys "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
. "github.com/cloudfoundry/bosh-agent/platform/disk"
)
var _ = Describe("cmdMountsSeacher", func() {
var (
runner *fakesys.FakeCmdRunner
searcher MountsSearcher
)
BeforeEach(func() {
runner = fakesys.NewFakeCmdRunner()
searcher = NewCmdMountsSearcher(runner)
})
Describe("SearchMounts", func() {
Context("when running command succeeds", func() {
It("returns parsed mount information", func() {
runner.AddCmdResult("mount", fakesys.FakeCmdResult{
Stdout: `devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
/dev/sda1 on /boot type ext2 (rw)
none on /tmp/warden/cgroup type tmpfs (rw)`,
开发者ID:viovanov,项目名称:bosh-agent,代码行数:31,代码来源:cmd_mounts_searcher_test.go
示例6: describeLinuxPlatform
func describeLinuxPlatform() {
var (
collector *fakestats.FakeCollector
fs *fakesys.FakeFileSystem
cmdRunner *fakesys.FakeCmdRunner
diskManager *fakedisk.FakeDiskManager
dirProvider boshdirs.Provider
devicePathResolver *fakedpresolv.FakeDevicePathResolver
platform Platform
cdutil *fakedevutil.FakeDeviceUtil
compressor boshcmd.Compressor
copier boshcmd.Copier
vitalsService boshvitals.Service
netManager *fakenet.FakeManager
certManager *fakecert.FakeManager
monitRetryStrategy *fakeretry.FakeRetryStrategy
fakeDefaultNetworkResolver *fakenet.FakeDefaultNetworkResolver
options LinuxOptions
logger boshlog.Logger
)
BeforeEach(func() {
logger = boshlog.NewLogger(boshlog.LevelNone)
collector = &fakestats.FakeCollector{}
fs = fakesys.NewFakeFileSystem()
cmdRunner = fakesys.NewFakeCmdRunner()
diskManager = fakedisk.NewFakeDiskManager()
dirProvider = boshdirs.NewProvider("/fake-dir")
cdutil = fakedevutil.NewFakeDeviceUtil()
compressor = boshcmd.NewTarballCompressor(cmdRunner, fs)
copier = boshcmd.NewCpCopier(cmdRunner, fs, logger)
vitalsService = boshvitals.NewService(collector, dirProvider)
netManager = &fakenet.FakeManager{}
certManager = new(fakecert.FakeManager)
monitRetryStrategy = fakeretry.NewFakeRetryStrategy()
devicePathResolver = fakedpresolv.NewFakeDevicePathResolver()
fakeDefaultNetworkResolver = &fakenet.FakeDefaultNetworkResolver{}
options = LinuxOptions{}
fs.SetGlob("/sys/bus/scsi/devices/*:0:0:0/block/*", []string{
"/sys/bus/scsi/devices/0:0:0:0/block/sr0",
"/sys/bus/scsi/devices/6:0:0:0/block/sdd",
"/sys/bus/scsi/devices/fake-host-id:0:0:0/block/sda",
})
fs.SetGlob("/sys/bus/scsi/devices/fake-host-id:0:fake-disk-id:0/block/*", []string{
"/sys/bus/scsi/devices/fake-host-id:0:fake-disk-id:0/block/sdf",
})
})
JustBeforeEach(func() {
platform = NewLinuxPlatform(
fs,
cmdRunner,
collector,
compressor,
copier,
dirProvider,
vitalsService,
cdutil,
diskManager,
netManager,
certManager,
monitRetryStrategy,
devicePathResolver,
5*time.Millisecond,
options,
logger,
fakeDefaultNetworkResolver,
)
})
Describe("SetupRuntimeConfiguration", func() {
It("setups runtime configuration", func() {
err := platform.SetupRuntimeConfiguration()
Expect(err).NotTo(HaveOccurred())
Expect(len(cmdRunner.RunCommands)).To(Equal(1))
Expect(cmdRunner.RunCommands[0]).To(Equal([]string{"bosh-agent-rc"}))
})
})
Describe("CreateUser", func() {
It("creates user", func() {
expectedUseradd := []string{
"useradd",
"-m",
"-b", "/some/path/to/home",
"-s", "/bin/bash",
"-p", "bar-pwd",
"foo-user",
}
err := platform.CreateUser("foo-user", "bar-pwd", "/some/path/to/home")
Expect(err).NotTo(HaveOccurred())
basePathStat := fs.GetFileTestStat("/some/path/to/home")
Expect(basePathStat.FileType).To(Equal(fakesys.FakeFileTypeDir))
//.........这里部分代码省略.........
开发者ID:guoger,项目名称:bosh-agent,代码行数:101,代码来源:linux_platform_test.go
示例7:
package net_test
import (
"errors"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"
fakesys "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
. "github.com/cloudfoundry/bosh-agent/platform/net"
)
var _ = Describe("cmdRoutesSeacher", func() {
var (
runner *fakesys.FakeCmdRunner
searcher RoutesSearcher
)
BeforeEach(func() {
runner = fakesys.NewFakeCmdRunner()
searcher = NewCmdRoutesSearcher(runner)
})
Describe("SearchRoutes", func() {
Context("when running command succeeds", func() {
It("returns parsed routes information", func() {
runner.AddCmdResult("route -n", fakesys.FakeCmdResult{
Stdout: `Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.16.79.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
开发者ID:viovanov,项目名称:bosh-agent,代码行数:31,代码来源:cmd_routes_searcher_test.go
示例8:
import (
"errors"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"
"github.com/cloudfoundry/bosh-agent/agent/scriptrunner"
fakesys "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
"path/filepath"
)
var _ = Describe("GenericScript", func() {
var (
fs *fakesys.FakeFileSystem
cmdRunner *fakesys.FakeCmdRunner
genericScript scriptrunner.GenericScript
stdoutLogPath string
stderrLogPath string
)
BeforeEach(func() {
fs = fakesys.NewFakeFileSystem()
cmdRunner = fakesys.NewFakeCmdRunner()
stdoutLogPath = filepath.Join("base", "stdout", "logdir", "stdout.log")
stderrLogPath = filepath.Join("base", "stderr", "logdir", "stderr.log")
genericScript = scriptrunner.NewScript(
"my-tag",
fs,
cmdRunner,
"/path-to-script",
stdoutLogPath,
开发者ID:gu-bin,项目名称:bosh-agent,代码行数:31,代码来源:generic_script_test.go
示例9:
package blobstore_test
import (
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/blobstore"
boshlog "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/logger"
fakesys "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
boshuuid "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/uuid"
)
var _ = Describe("Provider", func() {
var (
fs *fakesys.FakeFileSystem
runner *fakesys.FakeCmdRunner
logger boshlog.Logger
provider Provider
)
BeforeEach(func() {
fs = fakesys.NewFakeFileSystem()
runner = fakesys.NewFakeCmdRunner()
logger = boshlog.NewLogger(boshlog.LevelNone)
provider = NewProvider(fs, runner, "/var/vcap/config", logger)
})
Describe("Get", func() {
It("get dummy", func() {
blobstore, err := provider.Get(BlobstoreTypeDummy, map[string]interface{}{})
Expect(err).ToNot(HaveOccurred())
Expect(blobstore).ToNot(BeNil())
开发者ID:viovanov,项目名称:bosh-agent,代码行数:32,代码来源:provider_test.go
示例10: 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:viovanov,项目名称:bosh-agent,代码行数:101,代码来源:ubuntu_net_manager_test.go
示例11:
"strings"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
boshassert "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/assert"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/blobstore"
fakesys "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
fakeuuid "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/uuid/fakes"
)
var _ = Describe("externalBlobstore", func() {
var (
fs *fakesys.FakeFileSystem
runner *fakesys.FakeCmdRunner
uuidGen *fakeuuid.FakeGenerator
configPath string
blobstore Blobstore
)
BeforeEach(func() {
fs = fakesys.NewFakeFileSystem()
runner = fakesys.NewFakeCmdRunner()
uuidGen = &fakeuuid.FakeGenerator{}
configPath = filepath.Join("/etc/", "blobstore-fake-provider.json")
blobstore = NewExternalBlobstore("fake-provider", map[string]interface{}{}, fs, runner, uuidGen, configPath)
})
Describe("Validate", func() {
It("external validate writes config file", func() {
options := map[string]interface{}{"fake-key": "fake-value"}
开发者ID:pivotal-nader-ziada,项目名称:bosh-agent,代码行数:31,代码来源:external_blobstore_test.go
示例12:
package cdrom_test
import (
"errors"
fakesys "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-agent/platform/cdrom"
fakeudev "github.com/cloudfoundry/bosh-agent/platform/udevdevice/fakes"
)
var _ = Describe("LinuxCdrom", func() {
var (
udev *fakeudev.FakeUdevDevice
runner *fakesys.FakeCmdRunner
cd Cdrom
)
BeforeEach(func() {
udev = fakeudev.NewFakeUdevDevice()
runner = fakesys.NewFakeCmdRunner()
})
JustBeforeEach(func() {
cd = NewLinuxCdrom("/dev/sr0", udev, runner)
})
Describe("WaitForMedia", func() {
It("polls the cdrom to force udev to notice it", func() {
err := cd.WaitForMedia()
开发者ID:viovanov,项目名称:bosh-agent,代码行数:31,代码来源:linux_cdrom_test.go
示例13:
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"
fakeaction "github.com/cloudfoundry/bosh-agent/agent/action/fakes"
"github.com/cloudfoundry/bosh-agent/agent/applier/applyspec"
. "github.com/cloudfoundry/bosh-agent/agent/script/drain"
"github.com/cloudfoundry/bosh-agent/agent/script/drain/fakes"
boshsys "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system"
fakesys "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
)
var _ = Describe("ConcreteScript", func() {
var (
fs *fakesys.FakeFileSystem
runner *fakesys.FakeCmdRunner
params ScriptParams
fakeClock *fakeaction.FakeClock
script ConcreteScript
exampleSpec func() applyspec.V1ApplySpec
)
BeforeEach(func() {
fs = fakesys.NewFakeFileSystem()
runner = fakesys.NewFakeCmdRunner()
params = &fakes.FakeScriptParams{}
fakeClock = &fakeaction.FakeClock{}
})
JustBeforeEach(func() {
script = NewConcreteScript(fs, runner, "my-tag", "/fake/script", params, fakeClock)
})
开发者ID:pivotal-nader-ziada,项目名称:bosh-agent,代码行数:31,代码来源:concrete_script_test.go
示例14:
fakeFs.WriteFileString("/path/to/delete/stuff/in/delete_me_1.foo", "goodbye")
fakeFs.WriteFileString("/path/to/delete/stuff/in/delete_me_2.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.bar",
})
count, err := cert.DeleteFiles(fakeFs, "/path/to/delete/stuff/in/", "delete_me_")
Expect(err).To(HaveOccurred())
Expect(count).To(Equal(0))
})
})
Describe("cert.Manager implementations", func() {
var (
fakeFs *fakesys.FakeFileSystem
fakeCmd *fakesys.FakeCmdRunner
certManager cert.Manager
)
SharedLinuxCertManagerExamples := func(certBasePath, certUpdateProgram string) {
It("writes 1 cert to a file", func() {
err := certManager.UpdateCertificates(cert1)
Expect(err).NotTo(HaveOccurred())
Expect(fakeFs.FileExists(fmt.Sprintf("%s/bosh-trusted-cert-1.crt", certBasePath))).To(BeTrue())
})
It("writes each cert to its own file", func() {
certs := fmt.Sprintf("%s\n%s\n", cert1, cert1)
err := certManager.UpdateCertificates(certs)
Expect(err).NotTo(HaveOccurred())
开发者ID:viovanov,项目名称:bosh-agent,代码行数:31,代码来源:cert_manager_test.go
示例15:
import (
"errors"
"os"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/ginkgo"
. "github.com/cloudfoundry/bosh-agent/internal/github.com/onsi/gomega"
. "github.com/cloudfoundry/bosh-agent/agent/cmdrunner"
boshsys "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system"
fakesys "github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes"
)
var _ = Describe("FileLoggingCmdRunner", func() {
var (
fs *fakesys.FakeFileSystem
cmdRunner *fakesys.FakeCmdRunner
cmd boshsys.Command
runner CmdRunner
)
BeforeEach(func() {
fs = fakesys.NewFakeFileSystem()
cmdRunner = fakesys.NewFakeCmdRunner()
runner = NewFileLoggingCmdRunner(fs, cmdRunner, "/fake-base-dir", 15)
cmd = boshsys.Command{
Name: "fake-cmd",
Args: []string{"fake-args"},
Env: map[string]string{"fake-env-key": "fake-env-var"},
WorkingDir: "/fake-working-dir",
}
})
开发者ID:viovanov,项目名称:bosh-agent,代码行数:32,代码来源:file_logging_cmd_runner_test.go
注:本文中的github.com/cloudfoundry/bosh-agent/internal/github.com/cloudfoundry/bosh-utils/system/fakes.FakeCmdRunner类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论