// Phase returns the migration's phase. func (mig *ModelMigration) Phase() (migration.Phase, error) { phase, ok := migration.ParsePhase(mig.statusDoc.Phase) if !ok { return phase, errors.Errorf("invalid phase in DB: %v", mig.statusDoc.Phase) } return phase, nil }
func (s *PhaseSuite) TestParseInvalid(c *gc.C) { phase, ok := migration.ParsePhase("foo") c.Check(phase, gc.Equals, migration.UNKNOWN) c.Check(ok, jc.IsFalse) }
func (s *PhaseSuite) TestParseValid(c *gc.C) { phase, ok := migration.ParsePhase("REAP") c.Check(phase, gc.Equals, migration.REAP) c.Check(ok, jc.IsTrue) }