本文整理匯總了Golang中bosh/system/fakes.FakeFileSystem.GlobPaths方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeFileSystem.GlobPaths方法的具體用法?Golang FakeFileSystem.GlobPaths怎麽用?Golang FakeFileSystem.GlobPaths使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類bosh/system/fakes.FakeFileSystem
的用法示例。
在下文中一共展示了FakeFileSystem.GlobPaths方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: init
//.........這裏部分代碼省略.........
networks := boshsettings.Networks{
"bosh": boshsettings.Network{
Default: []string{"dns"},
Dns: []string{"xx.xx.xx.xx", "yy.yy.yy.yy", "zz.zz.zz.zz"},
},
"vip": boshsettings.Network{
Default: []string{},
Dns: []string{"aa.aa.aa.aa"},
},
}
platform.SetupDhcp(networks)
dhcpConfig := fs.GetFileTestStat("/etc/dhcp3/dhclient.conf")
assert.NotNil(GinkgoT(), dhcpConfig)
assert.Equal(GinkgoT(), dhcpConfig.Content, UBUNTU_EXPECTED_DHCP_CONFIG)
assert.Equal(GinkgoT(), len(cmdRunner.RunCommands), 0)
})
It("ubuntu setup manual networking", func() {
networks := boshsettings.Networks{
"bosh": boshsettings.Network{
Default: []string{"dns", "gateway"},
Ip: "192.168.195.6",
Netmask: "255.255.255.0",
Gateway: "192.168.195.1",
Mac: "22:00:0a:1f:ac:2a",
Dns: []string{"10.80.130.2", "10.80.130.1"},
},
}
fs.WriteToFile("/sys/class/net/eth0", "")
fs.WriteToFile("/sys/class/net/eth0/address", "22:00:0a:1f:ac:2a\n")
fs.GlobPaths = []string{"/sys/class/net/eth0"}
platform.SetupManualNetworking(networks)
networkConfig := fs.GetFileTestStat("/etc/network/interfaces")
assert.NotNil(GinkgoT(), networkConfig)
assert.Equal(GinkgoT(), networkConfig.Content, UBUNTU_EXPECTED_NETWORK_INTERFACES)
resolvConf := fs.GetFileTestStat("/etc/resolv.conf")
assert.NotNil(GinkgoT(), resolvConf)
assert.Equal(GinkgoT(), resolvConf.Content, UBUNTU_EXPECTED_RESOLV_CONF)
time.Sleep(100 * time.Millisecond)
assert.Equal(GinkgoT(), len(cmdRunner.RunCommands), 8)
assert.Equal(GinkgoT(), cmdRunner.RunCommands[0], []string{"service", "network-interface", "stop", "INTERFACE=eth0"})
assert.Equal(GinkgoT(), cmdRunner.RunCommands[1], []string{"service", "network-interface", "start", "INTERFACE=eth0"})
assert.Equal(GinkgoT(), cmdRunner.RunCommands[2], []string{"arping", "-c", "1", "-U", "-I", "eth0", "192.168.195.6"})
assert.Equal(GinkgoT(), cmdRunner.RunCommands[7], []string{"arping", "-c", "1", "-U", "-I", "eth0", "192.168.195.6"})
})
It("ubuntu setup logrotate", func() {
platform.SetupLogrotate("fake-group-name", "fake-base-path", "fake-size")
logrotateFileContent, err := fs.ReadFile("/etc/logrotate.d/fake-group-name")
assert.NoError(GinkgoT(), err)
assert.Equal(GinkgoT(), UBUNTU_EXPECTED_ETC_LOGROTATE, logrotateFileContent)
})
It("ubuntu set time with ntp servers", func() {
platform.SetTimeWithNtpServers([]string{"0.north-america.pool.ntp.org", "1.north-america.pool.ntp.org"})
ntpConfig := fs.GetFileTestStat("/fake-dir/bosh/etc/ntpserver")