Esempio n. 1
0
func (a *API) isValidNameCriteria(names []string) (bool, error) {
	for _, n := range names {
		if !storage.IsValidPoolName(n) {
			return false, errors.NotValidf("pool name %q", n)
		}
	}
	return true, nil
}
Esempio n. 2
0
func (a *API) validateNameCriteria(names []string) error {
	for _, n := range names {
		if !storage.IsValidPoolName(n) {
			return errors.NotValidf("pool name %q", n)
		}
	}
	return nil
}
Esempio n. 3
0
func (s *ConstraintsSuite) TestValidPoolName(c *gc.C) {
	c.Assert(storage.IsValidPoolName("pool"), jc.IsTrue)
	c.Assert(storage.IsValidPoolName("p-ool"), jc.IsTrue)
	c.Assert(storage.IsValidPoolName("p-00l"), jc.IsTrue)
	c.Assert(storage.IsValidPoolName("p?00l"), jc.IsTrue)
	c.Assert(storage.IsValidPoolName("p-?00l"), jc.IsTrue)
	c.Assert(storage.IsValidPoolName("p"), jc.IsTrue)
	c.Assert(storage.IsValidPoolName("P"), jc.IsTrue)
	c.Assert(storage.IsValidPoolName("p?0?l"), jc.IsTrue)
}
Esempio n. 4
0
func (s *ConstraintsSuite) TestInvalidPoolName(c *gc.C) {
	c.Assert(storage.IsValidPoolName("7ool"), jc.IsFalse)
	c.Assert(storage.IsValidPoolName("/ool"), jc.IsFalse)
	c.Assert(storage.IsValidPoolName("-00l"), jc.IsFalse)
	c.Assert(storage.IsValidPoolName("*00l"), jc.IsFalse)
}