Example #1
0
func (s *watcherSuite) TestMigrationStatusWatcherNoMigration(c *gc.C) {
	w := apiservertesting.NewFakeNotifyWatcher()
	id := s.resources.Register(w)
	s.authorizer.Tag = names.NewMachineTag("12")
	apiserver.PatchGetMigrationBackend(s, &fakeMigrationBackend{noMigration: true})

	facade := s.getFacade(c, "MigrationStatusWatcher", 1, id).(migrationStatusWatcher)
	defer c.Check(facade.Stop(), jc.ErrorIsNil)
	result, err := facade.Next()
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(result, jc.DeepEquals, params.MigrationStatus{
		Phase: "NONE",
	})
}
Example #2
0
func (s *watcherSuite) TestMigrationStatusWatcher(c *gc.C) {
	w := apiservertesting.NewFakeNotifyWatcher()
	id := s.resources.Register(w)
	s.authorizer.Tag = names.NewMachineTag("12")
	apiserver.PatchGetMigrationBackend(s, new(fakeMigrationBackend))
	apiserver.PatchGetControllerCACert(s, "no worries")

	facade := s.getFacade(c, "MigrationStatusWatcher", 1, id).(migrationStatusWatcher)
	defer c.Check(facade.Stop(), jc.ErrorIsNil)
	result, err := facade.Next()
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(result, jc.DeepEquals, params.MigrationStatus{
		MigrationId:    "id",
		Attempt:        2,
		Phase:          "IMPORT",
		SourceAPIAddrs: []string{"1.2.3.4:5", "2.3.4.5:6", "3.4.5.6:7"},
		SourceCACert:   "no worries",
		TargetAPIAddrs: []string{"1.2.3.4:5555"},
		TargetCACert:   "trust me",
	})
}