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