当前位置: 首页>>代码示例>>Golang>>正文


Golang C.SucceedNow方法代码示例

本文整理汇总了Golang中launchpad/net/gocheck.C.SucceedNow方法的典型用法代码示例。如果您正苦于以下问题:Golang C.SucceedNow方法的具体用法?Golang C.SucceedNow怎么用?Golang C.SucceedNow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在launchpad/net/gocheck.C的用法示例。


在下文中一共展示了C.SucceedNow方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TestListKeys

// Tests for Keys API
func (s *CloudAPISuite) TestListKeys(c *gc.C) {
	k := s.createKey(c, testKeyName, testKey)
	defer s.deleteKey(c, testKeyName)

	keys, err := s.service.ListKeys()
	c.Assert(err, gc.IsNil)
	for _, key := range keys {
		if c.Check(&key, gc.DeepEquals, k) {
			c.SucceedNow()
		}
	}
	c.Fatalf("Obtained keys [%s] do not contain test key [%s]", keys, k)
}
开发者ID:joyent,项目名称:gosdc,代码行数:14,代码来源:service_test.go

示例2: TestListMachines

// Test for Machine API
func (s *CloudAPISuite) TestListMachines(c *gc.C) {
	m := s.createMachine(c, testMachineName, testPackage, testImage, nil, nil)
	defer s.deleteMachine(c, m.Id)

	machines, err := s.service.ListMachines(nil)
	c.Assert(err, gc.IsNil)
	for _, machine := range machines {
		if machine.Id == m.Id {
			c.SucceedNow()
		}
	}
	c.Fatalf("Obtained machine [%v] do not contain test machine [%v]", machines, m)
}
开发者ID:joyent,项目名称:gosdc,代码行数:14,代码来源:service_test.go

示例3: TestSucceedNow

func (s *FoundationS) TestSucceedNow(c *gocheck.C) {
	defer (func() {
		if c.Failed() {
			c.Error("SucceedNow() didn't succeed the test")
		}
		if c.GetTestLog() != "" {
			c.Error("Something got logged:\n" + c.GetTestLog())
		}
	})()

	c.Fail()
	c.SucceedNow()
	c.Log("SucceedNow() didn't stop the test")
}
开发者ID:evaluation-alex,项目名称:gosync,代码行数:14,代码来源:foundation_test.go

示例4: TestInferURL

func (s *PublishSuite) TestInferURL(c *gc.C) {
	addMeta(c, s.branch, "")

	cmd := &PublishCommand{}
	cmd.ChangePushLocation(func(location string) string {
		c.Assert(location, gc.Equals, "lp:charms/precise/wordpress")
		c.SucceedNow()
		panic("unreachable")
	})

	_, err := testing.RunCommandInDir(c, envcmd.Wrap(cmd), []string{"precise/wordpress"}, s.dir)
	c.Assert(err, gc.IsNil)
	c.Fatal("shouldn't get here; location closure didn't run?")
}
开发者ID:jkary,项目名称:core,代码行数:14,代码来源:publish_test.go

示例5: TestListKeys

func (s *LiveTests) TestListKeys(c *gc.C) {
	s.createKey(c)

	keys, err := s.testClient.ListKeys()
	c.Assert(err, gc.IsNil)
	c.Assert(keys, gc.NotNil)
	fakeKey := cloudapi.Key{Name: "fake-key", Fingerprint: testKeyFingerprint, Key: testKey}
	for _, k := range keys {
		if c.Check(k, gc.DeepEquals, fakeKey) {
			c.SucceedNow()
		}
	}
	c.Fatalf("Obtained keys [%s] do not contain test key [%s]", keys, fakeKey)
}
开发者ID:cehoffman,项目名称:gosdc,代码行数:14,代码来源:live_test.go

示例6: TestListMachines

// Tests for Machines API
func (s *CloudAPIHTTPSuite) TestListMachines(c *gc.C) {
	var expected []cloudapi.Machine
	m := s.createMachine(c, testMachineName, testPackage, testImage, nil, nil)
	defer s.deleteMachine(c, m.Id)

	resp, err := s.sendRequest("GET", path.Join(testUserAccount, "machines"), nil, nil)
	c.Assert(err, gc.IsNil)
	c.Assert(resp.StatusCode, gc.Equals, http.StatusOK)
	assertJSON(c, resp, &expected)
	for _, machine := range expected {
		if machine.Id == m.Id {
			c.SucceedNow()
		}
	}
	c.Fatalf("Obtained machine [%s] do not contain test machine [%s]", expected, m)
}
开发者ID:joyent,项目名称:gosdc,代码行数:17,代码来源:service_http_test.go

示例7: TestListKeys

// Tests for Keys API
func (s *CloudAPIHTTPSuite) TestListKeys(c *gc.C) {
	var expected []cloudapi.Key
	k := s.createKey(c, testKeyName, testKey)
	defer s.deleteKey(c, testKeyName)

	resp, err := s.sendRequest("GET", path.Join(testUserAccount, "keys"), nil, nil)
	c.Assert(err, gc.IsNil)
	c.Assert(resp.StatusCode, gc.Equals, http.StatusOK)
	assertJSON(c, resp, &expected)
	for _, key := range expected {
		if c.Check(&key, gc.DeepEquals, k) {
			c.SucceedNow()
		}
	}
	c.Fatalf("Obtained keys [%s] do not contain test key [%s]", expected, k)
}
开发者ID:joyent,项目名称:gosdc,代码行数:17,代码来源:service_http_test.go

示例8: TestUnbindMultiUnits

func (s *S) TestUnbindMultiUnits(c *gocheck.C) {
	var calls int32
	ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		i := atomic.LoadInt32(&calls)
		i++
		atomic.StoreInt32(&calls, i)
		w.WriteHeader(http.StatusNoContent)
	}))
	defer ts.Close()
	srvc := service.Service{Name: "mysql", Endpoint: map[string]string{"production": ts.URL}}
	err := srvc.Create()
	c.Assert(err, gocheck.IsNil)
	defer s.conn.Services().Remove(bson.M{"_id": "mysql"})
	instance := service.ServiceInstance{
		Name:        "my-mysql",
		ServiceName: "mysql",
		Teams:       []string{s.team.Name},
		Apps:        []string{"painkiller"},
	}
	instance.Create()
	defer s.conn.ServiceInstances().Remove(bson.M{"name": "my-mysql"})
	a, err := createTestApp(s.conn, "painkiller", "", []string{s.team.Name})
	c.Assert(err, gocheck.IsNil)
	defer s.conn.Apps().Remove(bson.M{"name": a.Name})
	app.Provisioner.Provision(&a)
	defer app.Provisioner.Destroy(&a)
	app.Provisioner.AddUnits(&a, 1)
	err = instance.UnbindApp(&a)
	c.Assert(err, gocheck.IsNil)
	ok := make(chan bool, 1)
	go func() {
		t := time.Tick(1)
		for _ = <-t; atomic.LoadInt32(&calls) < 2; _ = <-t {
		}
		ok <- true
	}()
	select {
	case <-ok:
		c.SucceedNow()
	case <-time.After(1 * time.Second):
		c.Error("endpoint not called")
	}
}
开发者ID:ningjh,项目名称:tsuru,代码行数:43,代码来源:bind_test.go

示例9: TestUnbindCallsTheUnbindMethodFromAPI

func (s *BindSuite) TestUnbindCallsTheUnbindMethodFromAPI(c *gocheck.C) {
	var called int32
	ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		if r.Method == "DELETE" && r.URL.Path == "/resources/my-mysql/hostname/10.10.10.1" {
			atomic.StoreInt32(&called, 1)
		}
	}))
	defer ts.Close()
	srvc := service.Service{Name: "mysql", Endpoint: map[string]string{"production": ts.URL}}
	err := srvc.Create()
	c.Assert(err, gocheck.IsNil)
	defer s.conn.Services().Remove(bson.M{"_id": "mysql"})
	instance := service.ServiceInstance{
		Name:        "my-mysql",
		ServiceName: "mysql",
		Teams:       []string{s.team.Name},
		Apps:        []string{"painkiller"},
	}
	err = instance.Create()
	c.Assert(err, gocheck.IsNil)
	defer s.conn.ServiceInstances().Remove(bson.M{"name": "my-mysql"})
	a, err := createTestApp(s.conn, "painkiller", "", []string{s.team.Name})
	c.Assert(err, gocheck.IsNil)
	defer s.conn.Apps().Remove(bson.M{"name": a.Name})
	app.Provisioner.Provision(&a)
	defer app.Provisioner.Destroy(&a)
	app.Provisioner.AddUnits(&a, 1)
	err = instance.UnbindApp(&a)
	c.Assert(err, gocheck.IsNil)
	ch := make(chan bool)
	go func() {
		t := time.Tick(1)
		for _ = <-t; atomic.LoadInt32(&called) == 0; _ = <-t {
		}
		ch <- true
	}()
	select {
	case <-ch:
		c.SucceedNow()
	case <-time.After(1e9):
		c.Errorf("Failed to call API after 1 second.")
	}
}
开发者ID:rualatngua,项目名称:tsuru,代码行数:43,代码来源:bind_test.go


注:本文中的launchpad/net/gocheck.C.SucceedNow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。