• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang dependency.SelfManifold函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang dependency.Context类代码示例发布时间:2022-05-23
下一篇:
Golang dependency.NewEngine函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap