本文整理汇总了Golang中github.com/juju/juju/state.State.GetBlockForType方法的典型用法代码示例。如果您正苦于以下问题:Golang State.GetBlockForType方法的具体用法?Golang State.GetBlockForType怎么用?Golang State.GetBlockForType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/state.State
的用法示例。
在下文中一共展示了State.GetBlockForType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: assertEnvHasBlock
func assertEnvHasBlock(c *gc.C, st *state.State, t state.BlockType, msg string) {
dBlock, found, err := st.GetBlockForType(t)
c.Assert(err, jc.ErrorIsNil)
c.Assert(found, jc.IsTrue)
c.Assert(dBlock, gc.NotNil)
c.Assert(dBlock.Type(), gc.DeepEquals, t)
tag, err := dBlock.Tag()
c.Assert(err, jc.ErrorIsNil)
c.Assert(tag, gc.DeepEquals, st.ModelTag())
c.Assert(dBlock.Message(), gc.DeepEquals, msg)
}
示例2: assertModelHasBlock
func (s *blockSuite) assertModelHasBlock(c *gc.C, st *state.State, t state.BlockType, msg string) {
block, found, err := st.GetBlockForType(t)
c.Assert(err, jc.ErrorIsNil)
c.Assert(found, jc.IsTrue)
c.Assert(block, gc.NotNil)
c.Assert(block.Type(), gc.Equals, t)
tag, err := block.Tag()
c.Assert(err, jc.ErrorIsNil)
c.Assert(tag, gc.Equals, st.ModelTag())
c.Assert(block.Message(), gc.Equals, msg)
}