当前位置: 首页>>代码示例>>Golang>>正文


Golang WriteConfTest.CheckCommands方法代码示例

本文整理汇总了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)
}
开发者ID:Pankov404,项目名称:juju,代码行数:28,代码来源:service_test.go

示例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)
}
开发者ID:Pankov404,项目名称:juju,代码行数:30,代码来源: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


注:本文中的github.com/juju/juju/service/systemd/testing.WriteConfTest.CheckCommands方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。