當前位置: 首頁>>代碼示例>>Golang>>正文


Golang WriteConfTest.CheckInstallAndStartCommands方法代碼示例

本文整理匯總了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)
}
開發者ID:imoapps,項目名稱:juju,代碼行數:38,代碼來源:container_userdata_test.go


注:本文中的github.com/juju/juju/service/systemd/testing.WriteConfTest.CheckInstallAndStartCommands方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。