當前位置: 首頁>>代碼示例>>Golang>>正文


Golang dependency.SelfManifold函數代碼示例

本文整理匯總了Golang中github.com/juju/juju/worker/dependency.SelfManifold函數的典型用法代碼示例。如果您正苦於以下問題:Golang SelfManifold函數的具體用法?Golang SelfManifold怎麽用?Golang SelfManifold使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了SelfManifold函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestOutputReporter

func (s *SelfSuite) TestOutputReporter(c *gc.C) {
	manifold := dependency.SelfManifold(s.engine)
	var reporter dependency.Reporter
	err := manifold.Output(s.engine, &reporter)
	c.Check(err, jc.ErrorIsNil)
	c.Check(reporter, gc.Equals, s.engine)
}
開發者ID:imoapps,項目名稱:juju,代碼行數:7,代碼來源:self_test.go

示例2: TestActuallyWorks

func (s *SelfSuite) TestActuallyWorks(c *gc.C) {

	// Create and install a manifold with an unsatisfied dependency.
	mh1 := newManifoldHarness("self")
	err := s.engine.Install("dependent", mh1.Manifold())
	c.Assert(err, jc.ErrorIsNil)
	mh1.AssertNoStart(c)

	// Install an engine inside itself; once it's "started", dependent will
	// be restarted.
	manifold := dependency.SelfManifold(s.engine)
	err = s.engine.Install("self", manifold)
	c.Assert(err, jc.ErrorIsNil)
	mh1.AssertOneStart(c)

	// Check we can still stop it (with a timeout -- injudicious
	// implementation changes could induce deadlocks).
	done := make(chan struct{})
	go func() {
		err := worker.Stop(s.engine)
		c.Check(err, jc.ErrorIsNil)
		close(done)
	}()
	select {
	case <-done:
	case <-time.After(coretesting.LongWait):
		c.Fatalf("timed out")
	}
}
開發者ID:imoapps,項目名稱:juju,代碼行數:29,代碼來源:self_test.go

示例3: TestOutputInstaller

func (s *SelfSuite) TestOutputInstaller(c *gc.C) {
	manifold := dependency.SelfManifold(s.engine)
	var installer dependency.Installer
	err := manifold.Output(s.engine, &installer)
	c.Check(err, jc.ErrorIsNil)
	c.Check(installer, gc.Equals, s.engine)
}
開發者ID:imoapps,項目名稱:juju,代碼行數:7,代碼來源:self_test.go

示例4: TestOutputBadOutput

func (s *SelfSuite) TestOutputBadOutput(c *gc.C) {
	manifold := dependency.SelfManifold(s.engine)
	var unknown interface{}
	err := manifold.Output(s.engine, &unknown)
	c.Check(err, gc.ErrorMatches, "out should be a \\*Installer or a \\*Reporter; is .*")
	c.Check(unknown, gc.IsNil)
}
開發者ID:imoapps,項目名稱:juju,代碼行數:7,代碼來源:self_test.go

示例5: TestOutputBadInput

func (s *SelfSuite) TestOutputBadInput(c *gc.C) {
	s.fix.run(c, func(engine dependency.Engine) {
		manifold := dependency.SelfManifold(engine)
		var input dependency.Engine
		err := manifold.Output(input, nil)
		c.Check(err, gc.ErrorMatches, "unexpected input worker")
	})
}
開發者ID:AlexisBruemmer,項目名稱:juju,代碼行數:8,代碼來源:self_test.go

示例6: TestStart

func (s *SelfSuite) TestStart(c *gc.C) {
	s.fix.run(c, func(engine dependency.Engine) {
		manifold := dependency.SelfManifold(engine)
		actual, err := manifold.Start(nil)
		c.Check(err, jc.ErrorIsNil)
		c.Check(actual, gc.Equals, engine)
	})
}
開發者ID:AlexisBruemmer,項目名稱:juju,代碼行數:8,代碼來源:self_test.go

示例7: TestOutputInstaller

func (s *SelfSuite) TestOutputInstaller(c *gc.C) {
	s.fix.run(c, func(engine dependency.Engine) {
		manifold := dependency.SelfManifold(engine)
		var installer dependency.Installer
		err := manifold.Output(engine, &installer)
		c.Check(err, jc.ErrorIsNil)
		c.Check(installer, gc.Equals, engine)
	})
}
開發者ID:AlexisBruemmer,項目名稱:juju,代碼行數:9,代碼來源:self_test.go

示例8: TestOutputReporter

func (s *SelfSuite) TestOutputReporter(c *gc.C) {
	s.fix.run(c, func(engine *dependency.Engine) {
		manifold := dependency.SelfManifold(engine)
		var reporter dependency.Reporter
		err := manifold.Output(engine, &reporter)
		c.Check(err, jc.ErrorIsNil)
		c.Check(reporter, gc.Equals, engine)
	})
}
開發者ID:bac,項目名稱:juju,代碼行數:9,代碼來源:self_test.go

示例9: TestStress

func (s *SelfSuite) TestStress(c *gc.C) {
	s.fix.run(c, func(engine dependency.Engine) {

		// Repeatedly install a manifold inside itself.
		manifold := dependency.SelfManifold(engine)
		for i := 0; i < 100; i++ {
			go engine.Install(fmt.Sprintf("self-%d", i), manifold)
		}

		// Give it a moment to screw up if it's going to
		// (injudicious implementation could induce deadlock)
		// then let the fixture worry about a clean kill.
		workertest.CheckAlive(c, engine)
	})
}
開發者ID:AlexisBruemmer,項目名稱:juju,代碼行數:15,代碼來源:self_test.go

示例10: TestActuallyWorks

func (s *SelfSuite) TestActuallyWorks(c *gc.C) {

	// Install an engine inside itself.
	manifold := dependency.SelfManifold(s.engine)
	err := s.engine.Install("self", manifold)
	c.Assert(err, jc.ErrorIsNil)

	// Check we can still stop it (with a timeout -- injudicious
	// implementation changes could induce deadlocks).
	done := make(chan struct{})
	go func() {
		err := worker.Stop(s.engine)
		c.Check(err, jc.ErrorIsNil)
		close(done)
	}()
	select {
	case <-done:
	case <-time.After(coretesting.LongWait):
		c.Fatalf("timed out")
	}
}
開發者ID:snailwalker,項目名稱:juju,代碼行數:21,代碼來源:self_test.go

示例11: TestStress

func (s *SelfSuite) TestStress(c *gc.C) {

	// Repeatedly install a manifold inside itself.
	manifold := dependency.SelfManifold(s.engine)
	for i := 0; i < 100; i++ {
		go s.engine.Install(fmt.Sprintf("self-%d", i), manifold)
	}

	// Check we can still stop it (with a timeout -- injudicious
	// implementation changes could induce deadlocks).
	done := make(chan struct{})
	go func() {
		err := worker.Stop(s.engine)
		c.Check(err, jc.ErrorIsNil)
		close(done)
	}()
	select {
	case <-done:
	case <-time.After(coretesting.LongWait):
		c.Fatalf("timed out")
	}
}
開發者ID:imoapps,項目名稱:juju,代碼行數:22,代碼來源:self_test.go

示例12: TestActuallyWorks

func (s *SelfSuite) TestActuallyWorks(c *gc.C) {
	s.fix.run(c, func(engine dependency.Engine) {

		// Create and install a manifold with an unsatisfied dependency.
		mh1 := newManifoldHarness("self")
		err := engine.Install("dependent", mh1.Manifold())
		c.Assert(err, jc.ErrorIsNil)
		mh1.AssertNoStart(c)

		// Install an engine inside itself; once it's "started", dependent will
		// be restarted.
		manifold := dependency.SelfManifold(engine)
		err = engine.Install("self", manifold)
		c.Assert(err, jc.ErrorIsNil)
		mh1.AssertOneStart(c)

		// Give it a moment to screw up if it's going to
		// (injudicious implementation could induce deadlock)
		// then let the fixture worry about a clean kill.
		workertest.CheckAlive(c, engine)
	})
}
開發者ID:AlexisBruemmer,項目名稱:juju,代碼行數:22,代碼來源:self_test.go

示例13: TestStart

func (s *SelfSuite) TestStart(c *gc.C) {
	manifold := dependency.SelfManifold(s.engine)
	engine, err := manifold.Start(nil)
	c.Check(err, jc.ErrorIsNil)
	c.Check(engine, gc.Equals, s.engine)
}
開發者ID:imoapps,項目名稱:juju,代碼行數:6,代碼來源:self_test.go

示例14: TestInputs

func (s *SelfSuite) TestInputs(c *gc.C) {
	manifold := dependency.SelfManifold(s.engine)
	c.Check(manifold.Inputs, gc.HasLen, 0)
}
開發者ID:imoapps,項目名稱:juju,代碼行數:4,代碼來源:self_test.go

示例15: TestInputs

func (s *SelfSuite) TestInputs(c *gc.C) {
	s.fix.run(c, func(engine dependency.Engine) {
		manifold := dependency.SelfManifold(engine)
		c.Check(manifold.Inputs, gc.HasLen, 0)
	})
}
開發者ID:AlexisBruemmer,項目名稱:juju,代碼行數:6,代碼來源:self_test.go


注:本文中的github.com/juju/juju/worker/dependency.SelfManifold函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。