func (s *FactorySuite) AssertRelationContext(c *gc.C, ctx runner.Context, relId int, remoteUnit string) *runner.ContextRelation { actualRemoteUnit, _ := ctx.RemoteUnitName() c.Assert(actualRemoteUnit, gc.Equals, remoteUnit) rel, found := ctx.HookRelation() c.Assert(found, jc.IsTrue) c.Assert(rel.Id(), gc.Equals, relId) return rel.(*runner.ContextRelation) }
func notifyHook(hook string, ctx runner.Context, method func(string)) { if r, err := ctx.HookRelation(); err == nil { remote, _ := ctx.RemoteUnitName() if remote != "" { remote = " " + remote } hook = hook + remote + " " + r.FakeId() } method(hook) }
func (s *FactorySuite) AssertNotRelationContext(c *gc.C, ctx runner.Context) { rel, found := ctx.HookRelation() c.Assert(rel, gc.IsNil) c.Assert(found, jc.IsFalse) }