本文整理匯總了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)
}