本文整理匯總了Golang中github.com/juju/juju/service/common.Service類的典型用法代碼示例。如果您正苦於以下問題:Golang Service類的具體用法?Golang Service怎麽用?Golang Service使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Service類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestNoConfMissing
func (*serviceSuite) TestNoConfMissing(c *gc.C) {
service := common.Service{
Name: "a-application",
}
noConf := service.NoConf()
c.Check(noConf, jc.IsTrue)
}
示例2: TestNoConfEmpty
func (*serviceSuite) TestNoConfEmpty(c *gc.C) {
service := common.Service{
Name: "a-application",
Conf: common.Conf{},
}
noConf := service.NoConf()
c.Check(noConf, jc.IsTrue)
}
示例3: TestValidateMissingExecStart
func (*serviceSuite) TestValidateMissingExecStart(c *gc.C) {
service := common.Service{
Name: "a-application",
Conf: common.Conf{
Desc: "some service",
},
}
err := service.Validate(renderer)
c.Check(err, gc.ErrorMatches, ".*missing ExecStart.*")
}
示例4: TestValidateMissingDesc
func (*serviceSuite) TestValidateMissingDesc(c *gc.C) {
service := common.Service{
Name: "a-application",
Conf: common.Conf{
ExecStart: "/path/to/some-command x y z",
},
}
err := service.Validate(renderer)
c.Check(err, gc.ErrorMatches, ".*missing Desc.*")
}
示例5: TestValidateMissingName
func (*serviceSuite) TestValidateMissingName(c *gc.C) {
service := common.Service{
Conf: common.Conf{
Desc: "some service",
ExecStart: "/path/to/some-command x y z",
},
}
err := service.Validate(renderer)
c.Check(err, gc.ErrorMatches, ".*missing Name.*")
}
示例6: TestValidateOkay
func (*serviceSuite) TestValidateOkay(c *gc.C) {
service := common.Service{
Name: "a-application",
Conf: common.Conf{
Desc: "some service",
ExecStart: "/path/to/some-command x y z",
},
}
err := service.Validate(renderer)
c.Check(err, jc.ErrorIsNil)
}
示例7: TestNoConfFalse
func (*serviceSuite) TestNoConfFalse(c *gc.C) {
service := common.Service{
Name: "a-application",
Conf: common.Conf{
Desc: "some service",
ExecStart: "/path/to/some-command x y z",
},
}
noConf := service.NoConf()
c.Check(noConf, jc.IsFalse)
}