OpStep: uniter.Pending, }, err: `missing charm URL`, }, { st: uniter.State{ Op: uniter.Install, OpStep: uniter.Pending, CharmURL: stcurl, }, }, // RunHook operation. { st: uniter.State{ Op: uniter.RunHook, OpStep: uniter.Pending, Hook: &hook.Info{Kind: hooks.Kind("machine-exploded")}, }, err: `unknown hook kind "machine-exploded"`, }, { st: uniter.State{ Op: uniter.RunHook, OpStep: uniter.Pending, Hook: &hook.Info{Kind: hooks.RelationJoined}, }, err: `"relation-joined" hook requires a remote unit`, }, { st: uniter.State{ Op: uniter.RunHook, OpStep: uniter.Pending, Hook: &hook.Info{Kind: hooks.ConfigChanged}, CharmURL: stcurl,
var validateTests = []struct { info hook.Info err string }{ { hook.Info{Kind: hooks.RelationJoined}, `"relation-joined" hook requires a remote unit`, }, { hook.Info{Kind: hooks.RelationChanged}, `"relation-changed" hook requires a remote unit`, }, { hook.Info{Kind: hooks.RelationDeparted}, `"relation-departed" hook requires a remote unit`, }, { hook.Info{Kind: hooks.Kind("grok")}, `unknown hook kind "grok"`, }, {hook.Info{Kind: hooks.Install}, ""}, {hook.Info{Kind: hooks.Start}, ""}, {hook.Info{Kind: hooks.ConfigChanged}, ""}, {hook.Info{Kind: hooks.UpgradeCharm}, ""}, {hook.Info{Kind: hooks.Stop}, ""}, {hook.Info{Kind: hooks.RelationJoined, RemoteUnit: "x"}, ""}, {hook.Info{Kind: hooks.RelationChanged, RemoteUnit: "x"}, ""}, {hook.Info{Kind: hooks.RelationDeparted, RemoteUnit: "x"}, ""}, {hook.Info{Kind: hooks.RelationBroken}, ""}, } func (s *InfoSuite) TestValidate(c *gc.C) { for i, t := range validateTests {