本文整理汇总了Golang中github.com/juju/juju/service/systemd/testing.WriteConfTest.CheckCommands方法的典型用法代码示例。如果您正苦于以下问题:Golang WriteConfTest.CheckCommands方法的具体用法?Golang WriteConfTest.CheckCommands怎么用?Golang WriteConfTest.CheckCommands使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/service/systemd/testing.WriteConfTest
的用法示例。
在下文中一共展示了WriteConfTest.CheckCommands方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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)
}
示例2: 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)
}
示例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)
}