示例#1
0
func (r *upgradingRootSuite) TestFindNonExistentMethod(c *gc.C) {
	root := apiserver.TestingUpgradingRoot(nil)

	caller, err := root.FindMethod("Foo", 0, "Bar")

	c.Assert(err, gc.ErrorMatches, "unknown object type \"Foo\"")
	c.Assert(caller, gc.IsNil)
}
示例#2
0
func (r *upgradingRootSuite) TestFindMethodNonExistentVersion(c *gc.C) {
	root := apiserver.TestingUpgradingRoot(nil)

	caller, err := root.FindMethod("Client", 99999999, "Status")

	c.Assert(err, gc.ErrorMatches, "unknown version \\(99999999\\) of interface \"Client\"")
	c.Assert(caller, gc.IsNil)
}
示例#3
0
func (r *upgradingRootSuite) TestFindDisallowedMethod(c *gc.C) {
	root := apiserver.TestingUpgradingRoot(nil)

	caller, err := root.FindMethod("Client", 0, "ServiceDeploy")

	c.Assert(err, gc.ErrorMatches, "upgrade in progress - Juju functionality is limited")
	c.Assert(caller, gc.IsNil)
}
示例#4
0
func (r *upgradingRootSuite) TestFindAllowedMethod(c *gc.C) {
	root := apiserver.TestingUpgradingRoot(nil)

	caller, err := root.FindMethod("Client", 0, "FullStatus")

	c.Assert(err, gc.IsNil)
	c.Assert(caller, gc.NotNil)
}
示例#5
0
func (r *upgradingRootSuite) TestClientMethods(c *gc.C) {
	root := apiserver.TestingUpgradingRoot(nil)

	for _, method := range []string{
		"FullStatus", "ModelGet", "PrivateAddress",
		"PublicAddress",
	} {
		caller, err := root.FindMethod("Client", 1, method)
		c.Check(err, jc.ErrorIsNil)
		c.Check(caller, gc.NotNil)
	}
}
示例#6
0
func (r *restrictUpgradesSuite) TestAllowedMethods(c *gc.C) {
	root := apiserver.TestingUpgradingRoot(nil)
	checkAllowed := func(facade, method string) {
		caller, err := root.FindMethod(facade, 1, method)
		c.Check(err, jc.ErrorIsNil)
		c.Check(caller, gc.NotNil)
	}
	checkAllowed("Client", "FullStatus")
	checkAllowed("Client", "AbortCurrentUpgrade")
	checkAllowed("SSHClient", "PublicAddress")
	checkAllowed("SSHClient", "Proxy")
	checkAllowed("Pinger", "Ping")
}
示例#7
0
func (r *restrictUpgradesSuite) TestFindDisallowedMethod(c *gc.C) {
	root := apiserver.TestingUpgradingRoot(nil)
	caller, err := root.FindMethod("Client", 1, "ModelSet")
	c.Assert(errors.Cause(err), gc.Equals, params.UpgradeInProgressError)
	c.Assert(caller, gc.IsNil)
}