本文整理汇总了Golang中github.com/juju/juju/service/systemd/testing.WriteConfTest类的典型用法代码示例。如果您正苦于以下问题:Golang WriteConfTest类的具体用法?Golang WriteConfTest怎么用?Golang WriteConfTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WriteConfTest类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestInstallCommandsShutdown
func (s *initSystemSuite) TestInstallCommandsShutdown(c *gc.C) {
name := "juju-shutdown-job"
conf, err := service.ShutdownAfterConf("cloud-final")
c.Assert(err, jc.ErrorIsNil)
svc, err := systemd.NewService(name, conf, s.dataDir)
c.Assert(err, jc.ErrorIsNil)
commands, err := svc.InstallCommands()
c.Assert(err, jc.ErrorIsNil)
test := systemdtesting.WriteConfTest{
Service: name,
DataDir: s.dataDir,
Expected: `
[Unit]
Description=juju shutdown job
After=syslog.target
After=network.target
After=systemd-user-sessions.service
After=cloud-final
[Service]
ExecStart=/sbin/shutdown -h now
ExecStopPost=/bin/systemctl disable juju-shutdown-job.service
[Install]
WantedBy=multi-user.target
`[1:],
}
test.CheckCommands(c, commands)
}
开发者ID:Pankov404,项目名称:juju,代码行数:30,代码来源:service_test.go
示例2: TestInstallCommandsLogfile
func (s *initSystemSuite) TestInstallCommandsLogfile(c *gc.C) {
name := "jujud-machine-0"
s.conf.Logfile = "/var/log/juju/machine-0.log"
service := s.newService(c)
commands, err := service.InstallCommands()
c.Assert(err, jc.ErrorIsNil)
test := systemdtesting.WriteConfTest{
Service: name,
DataDir: s.dataDir,
Expected: strings.Replace(
s.newConfStr(name),
"ExecStart=/var/lib/juju/bin/jujud machine-0",
"ExecStart=/var/lib/juju/init/jujud-machine-0/exec-start.sh",
-1),
Script: `
# Set up logging.
touch '/var/log/juju/machine-0.log'
chown syslog:syslog '/var/log/juju/machine-0.log'
chmod 0600 '/var/log/juju/machine-0.log'
exec >> '/var/log/juju/machine-0.log'
exec 2>&1
# Run the script.
`[1:] + jujud + " machine-0",
}
test.CheckCommands(c, commands)
}
开发者ID:Pankov404,项目名称:juju,代码行数:28,代码来源:service_test.go
示例3: TestInstallCommands
func (s *initSystemSuite) TestInstallCommands(c *gc.C) {
name := "jujud-machine-0"
commands, err := s.service.InstallCommands()
c.Assert(err, jc.ErrorIsNil)
test := systemdtesting.WriteConfTest{
Service: name,
DataDir: s.dataDir,
Expected: s.newConfStr(name),
}
test.CheckCommands(c, commands)
}
开发者ID:Pankov404,项目名称:juju,代码行数:12,代码来源:service_test.go
示例4: TestShutdownInitCommandsSystemd
func (s *UserDataSuite) TestShutdownInitCommandsSystemd(c *gc.C) {
s.SetFeatureFlags(feature.AddressAllocation)
commands, err := containerinit.ShutdownInitCommands(service.InitSystemSystemd, "vivid")
c.Assert(err, jc.ErrorIsNil)
test := systemdtesting.WriteConfTest{
Service: "juju-template-restart",
DataDir: "/var/lib/juju",
Expected: `
[Unit]
Description=juju shutdown job
After=syslog.target
After=network.target
After=systemd-user-sessions.service
After=cloud-config.target
[Service]
ExecStart=/var/lib/juju/init/juju-template-restart/exec-start.sh
ExecStopPost=/bin/systemctl disable juju-template-restart.service
[Install]
WantedBy=multi-user.target
`[1:],
Script: `
/bin/cat > /etc/network/interfaces << EOC
# loopback interface
auto lo
iface lo inet loopback
# primary interface
auto eth0
iface eth0 inet dhcp
EOC
/bin/rm -fr /var/lib/dhcp/dhclient* /var/log/cloud-init*.log
/sbin/shutdown -h now`[1:],
}
test.CheckInstallAndStartCommands(c, commands)
}
开发者ID:imoapps,项目名称:juju,代码行数:38,代码来源:container_userdata_test.go
注:本文中的github.com/juju/juju/service/systemd/testing.WriteConfTest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论