func (s *lxcProvisionerSuite) expectStarted(c *gc.C, machine *state.Machine) string { // This check in particular leads to tests just hanging // indefinitely quite often on i386. coretesting.SkipIfI386(c, "lp:1425569") var event mock.Event s.State.StartSync() select { case event = <-s.events: c.Assert(event.Action, gc.Equals, mock.Created) argsSet := set.NewStrings(event.TemplateArgs...) c.Assert(argsSet.Contains("imageURL"), jc.IsTrue) case <-time.After(coretesting.LongWait): c.Fatalf("timeout while waiting the mock container to get created") } select { case event = <-s.events: c.Assert(event.Action, gc.Equals, mock.Started) err := machine.Refresh() c.Assert(err, jc.ErrorIsNil) case <-time.After(coretesting.LongWait): c.Fatalf("timeout while waiting the mock container to start") } s.waitInstanceId(c, machine, instance.Id(event.InstanceId)) return event.InstanceId }
func (s *withoutControllerSuite) TestWatchMachineErrorRetry(c *gc.C) { coretesting.SkipIfI386(c, "lp:1425569") s.PatchValue(&provisioner.ErrorRetryWaitDelay, 2*coretesting.ShortWait) c.Assert(s.resources.Count(), gc.Equals, 0) _, err := s.provisioner.WatchMachineErrorRetry() c.Assert(err, jc.ErrorIsNil) // Verify the resources were registered and stop them when done. c.Assert(s.resources.Count(), gc.Equals, 1) resource := s.resources.Get("1") defer statetesting.AssertStop(c, resource) // Check that the Watch has consumed the initial event ("returned" // in the Watch call) wc := statetesting.NewNotifyWatcherC(c, s.State, resource.(state.NotifyWatcher)) wc.AssertNoChange() // We should now get a time triggered change. wc.AssertOneChange() // Make sure WatchMachineErrorRetry fails with a machine agent login. anAuthorizer := s.authorizer anAuthorizer.Tag = names.NewMachineTag("1") anAuthorizer.EnvironManager = false aProvisioner, err := provisioner.NewProvisionerAPI(s.State, s.resources, anAuthorizer) c.Assert(err, jc.ErrorIsNil) result, err := aProvisioner.WatchMachineErrorRetry() c.Assert(err, gc.ErrorMatches, "permission denied") c.Assert(result, gc.DeepEquals, params.NotifyWatchResult{}) }
func (s *workerSuite) TestSetMembersErrorIsNotFatal(c *gc.C) { coretesting.SkipIfI386(c, "lp:1425569") DoTestForIPv4AndIPv6(func(ipVersion TestIPVersion) { st := NewFakeState() InitState(c, st, 3, ipVersion) st.session.setStatus(mkStatuses("0p 1s 2s", ipVersion)) var setCount voyeur.Value st.errors.setErrorFuncFor("Session.Set", func() error { setCount.Set(true) return errors.New("sample") }) s.PatchValue(&initialRetryInterval, 10*time.Microsecond) s.PatchValue(&maxRetryInterval, coretesting.ShortWait/4) w := newWorker(st, noPublisher{}) defer func() { c.Check(worker.Stop(w), gc.IsNil) }() // See that the worker is retrying. setCountW := setCount.Watch() mustNext(c, setCountW) mustNext(c, setCountW) mustNext(c, setCountW) }) }
func (s *kvmProvisionerSuite) expectStopped(c *gc.C, instId string) { // This check in particular leads to tests just hanging // indefinitely quite often on i386. coretesting.SkipIfI386(c, "lp:1425569") s.State.StartSync() event := s.nextEvent(c) c.Assert(event.Action, gc.Equals, mock.Stopped) c.Assert(event.InstanceId, gc.Equals, instId) }
func (s *FilterSuite) TestUnitRemoval(c *gc.C) { coretesting.SkipIfI386(c, "lp:1425569") f, err := filter.NewFilter(s.uniter, s.unit.Tag().(names.UnitTag)) c.Assert(err, jc.ErrorIsNil) defer f.Stop() // no AssertStop, we test for an error below // short-circuit to remove because no status set. err = s.unit.Destroy() c.Assert(err, jc.ErrorIsNil) s.assertAgentTerminates(c, f) }
func (s *kvmProvisionerSuite) expectStarted(c *gc.C, machine *state.Machine) string { // This check in particular leads to tests just hanging // indefinitely quite often on i386. coretesting.SkipIfI386(c, "lp:1425569") s.State.StartSync() event := s.nextEvent(c) c.Assert(event.Action, gc.Equals, mock.Started) err := machine.Refresh() c.Assert(err, jc.ErrorIsNil) s.waitInstanceId(c, machine, instance.Id(event.InstanceId)) return event.InstanceId }
func (s *UpgradeSuite) TestUpgradeStepsStateServer(c *gc.C) { coretesting.SkipIfI386(c, "lp:1444576") coretesting.SkipIfPPC64EL(c, "lp:1444576") coretesting.SkipIfWindowsBug(c, "lp:1446885") s.setInstantRetryStrategy(c) // Upload tools to provider storage, so they can be migrated to environment storage. stor, err := environs.LegacyStorage(s.State) if !errors.IsNotSupported(err) { c.Assert(err, jc.ErrorIsNil) envtesting.AssertUploadFakeToolsVersions( c, stor, "releases", s.Environ.Config().AgentStream(), s.oldVersion) } s.assertUpgradeSteps(c, state.JobManageEnviron) s.assertStateServerUpgrades(c) }
func (s *kvmProvisionerSuite) TestContainerStartedAndStopped(c *gc.C) { coretesting.SkipIfI386(c, "lp:1425569") p := s.newKvmProvisioner(c) defer stop(c, p) container := s.addContainer(c) instId := s.expectStarted(c, container) // ...and removed, along with the machine, when the machine is Dead. c.Assert(container.EnsureDead(), gc.IsNil) s.expectStopped(c, instId) s.waitRemoved(c, container) }
func (s *lxcProvisionerSuite) TestContainerStartedAndStopped(c *gc.C) { coretesting.SkipIfI386(c, "lp:1425569") p := s.newLxcProvisioner(c) defer stop(c, p) container := s.addContainer(c) name := "juju-" + container.Tag().String() containertesting.EnsureLXCRootFSEtcNetwork(c, name) instId := s.expectStarted(c, container) // ...and removed, along with the machine, when the machine is Dead. c.Assert(container.EnsureDead(), gc.IsNil) s.expectStopped(c, instId) s.waitRemoved(c, container) }
func (s *lxcProvisionerSuite) expectStopped(c *gc.C, instId string) { // This check in particular leads to tests just hanging // indefinitely quite often on i386. coretesting.SkipIfI386(c, "lp:1425569") s.State.StartSync() select { case event := <-s.events: c.Assert(event.Action, gc.Equals, mock.Stopped) case <-time.After(coretesting.LongWait): c.Fatalf("timeout while waiting the mock container to stop") } select { case event := <-s.events: c.Assert(event.Action, gc.Equals, mock.Destroyed) c.Assert(event.InstanceId, gc.Equals, instId) case <-time.After(coretesting.LongWait): c.Fatalf("timeout while waiting the mock container to get destroyed") } }