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

Golang require.NoError函数代码示例

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

本文整理汇总了Golang中github.com/alexsacr/linode/_third_party/testify/require.NoError函数的典型用法代码示例。如果您正苦于以下问题:Golang NoError函数的具体用法?Golang NoError怎么用?Golang NoError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: TestAvailLinodePlansIntegration

func TestAvailLinodePlansIntegration(t *testing.T) {
	c := NewClient(apiKey)

	plans, err := c.AvailLinodePlans(nil)
	require.NoError(t, err)
	require.NotEmpty(t, plans)

	testPlanNotEmpty(t, plans)

	// Spot check
	plans, err = c.AvailLinodePlans(Int(1))
	require.NoError(t, err)
	require.Len(t, plans, 1)

	p := plans[0]

	assert.Equal(t, 1, p.Cores)
	assert.Equal(t, 10.00, p.Price)
	assert.Equal(t, 1024, p.RAM)
	assert.Equal(t, 2000, p.Xfer)
	assert.Equal(t, 1, p.ID)
	assert.Equal(t, "Linode 1024", p.Label)
	assert.Equal(t, 24, p.Disk)
	assert.Equal(t, 0.015, p.Hourly)

	plans, err = c.AvailLinodePlans(Int(3498230))
	require.NoError(t, err)
	require.Empty(t, plans)
}
开发者ID:alexsacr,项目名称:linode,代码行数:29,代码来源:integration_test.go


示例2: TestAvailStackScriptsIntegration

func TestAvailStackScriptsIntegration(t *testing.T) {
	c := NewClient(apiKey)

	sscripts, err := c.AvailStackScripts(nil, nil, nil)
	require.NoError(t, err)
	require.NotEmpty(t, sscripts)

	testSSNotEmpty(t, sscripts)

	sscripts, err = c.AvailStackScripts(Int(3133731337), String("bar"), String("baz"))
	require.NoError(t, err)
	require.Empty(t, sscripts)
}
开发者ID:alexsacr,项目名称:linode,代码行数:13,代码来源:integration_test.go


示例3: TestNodeBalancerDeleteOK

func TestNodeBalancerDeleteOK(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockNodeBalancerDeleteOK()))
	defer ts.Close()

	err := c.NodeBalancerDelete(13128)
	require.NoError(t, err)
}
开发者ID:alexsacr,项目名称:linode,代码行数:7,代码来源:api_nodebalancer_test.go


示例4: TestNodeBalancerConfigListOK

func TestNodeBalancerConfigListOK(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockNodeBalancerConfigListOK()))
	defer ts.Close()

	nbconfs, err := c.NodeBalancerConfigList(13128, Int(14591))
	require.NoError(t, err)
	require.Len(t, nbconfs, 1)

	nbc := nbconfs[0]
	assert.Equal(t, "http_cookie", nbc.Stickiness)
	assert.Equal(t, "", nbc.SSLCommonName)
	assert.Equal(t, "/foo", nbc.CheckPath)
	assert.Equal(t, "bar", nbc.CheckBody)
	assert.Equal(t, 30, nbc.CheckInterval)
	assert.Equal(t, "", nbc.SSLFingerprint)
	assert.Equal(t, "roundrobin", nbc.Algorithm)
	assert.Equal(t, 14591, nbc.ID)
	assert.Equal(t, 15, nbc.CheckAttempts)
	assert.Equal(t, 13128, nbc.NodeBalancerID)
	assert.Equal(t, 80, nbc.Port)
	assert.Equal(t, "http", nbc.Check)
	assert.False(t, nbc.CheckPassive)
	assert.Equal(t, "http", nbc.Protocol)
	assert.Equal(t, 29, nbc.CheckTimeout)
}
开发者ID:alexsacr,项目名称:linode,代码行数:25,代码来源:api_nodebalancer_test.go


示例5: TestLinodeImageDeleteOK

func TestLinodeImageDeleteOK(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockImageDeleteOK()))
	defer ts.Close()

	err := c.ImageDelete(402716)
	require.NoError(t, err)
}
开发者ID:alexsacr,项目名称:linode,代码行数:7,代码来源:api_image_test.go


示例6: TestLinodeImageUpdateOK

func TestLinodeImageUpdateOK(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockImageUpdateOK()))
	defer ts.Close()

	err := c.ImageUpdate(402716, String("baz"), String("quux"))
	require.NoError(t, err)
}
开发者ID:alexsacr,项目名称:linode,代码行数:7,代码来源:api_image_test.go


示例7: TestDomainDeleteOK

func TestDomainDeleteOK(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockDomainDeleteOK()))
	defer ts.Close()

	err := c.DomainDelete(716074)
	require.NoError(t, err)
}
开发者ID:alexsacr,项目名称:linode,代码行数:7,代码来源:api_dns_test.go


示例8: TestStackScriptDeleteOK

func TestStackScriptDeleteOK(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockStackScriptDeleteOK()))
	defer ts.Close()

	err := c.StackScriptDelete(12567)
	require.NoError(t, err)
}
开发者ID:alexsacr,项目名称:linode,代码行数:7,代码来源:api_stackscript_test.go


示例9: TestLinodeDiskUpdateOK

func TestLinodeDiskUpdateOK(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockLinodeDiskUpdateOK()))
	defer ts.Close()

	err := c.LinodeDiskUpdate(1139016, 3569577, String("updated-label"), Bool(true))
	require.NoError(t, err)
}
开发者ID:alexsacr,项目名称:linode,代码行数:7,代码来源:api_linode_test.go


示例10: TestLinodeIPSwap

func TestLinodeIPSwap(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockLinodeIPSwapOK()))
	defer ts.Close()

	err := c.LinodeIPSwap(296963, Int(296386), Int(1))
	require.NoError(t, err)
}
开发者ID:alexsacr,项目名称:linode,代码行数:7,代码来源:api_linode_test.go


示例11: TestLinodeConfigList

func TestLinodeConfigList(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockLinodeConfigListOK()))
	defer ts.Close()

	confs, err := c.LinodeConfigList(1139016, Int(1855685))
	require.NoError(t, err)
	require.Len(t, confs, 1)

	cfg := confs[0]
	assert.Equal(t, "bar", cfg.RootDeviceCustom)
	assert.Equal(t, "foo", cfg.Comments)
	assert.Equal(t, "test-conf1", cfg.Label)
	assert.Equal(t, 1855685, cfg.ID)
	assert.Equal(t, "3569234,3569220,,,,,,,", cfg.DiskList)
	assert.Equal(t, "default", cfg.RunLevel)
	assert.Equal(t, 1, cfg.RootDeviceNum)
	assert.Equal(t, 800, cfg.RAMLimit)
	assert.Equal(t, "paravirt", cfg.VirtMode)
	assert.Equal(t, 1139016, cfg.LinodeID)
	assert.Equal(t, 138, cfg.KernelID)
	assert.True(t, cfg.DevTmpFSAutomount)
	assert.True(t, cfg.HelperDistro)
	assert.True(t, cfg.HelperDisableUpdateDB)
	assert.True(t, cfg.HelperDepmod)
	assert.True(t, cfg.HelperXen)
	assert.True(t, cfg.RootDeviceRO)
	assert.True(t, cfg.HelperNetwork)
	assert.True(t, cfg.IsRescue)
}
开发者ID:alexsacr,项目名称:linode,代码行数:29,代码来源:api_linode_test.go


示例12: TestLinodeResizeOK

func TestLinodeResizeOK(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockLinodeResizeOK()))
	defer ts.Close()

	err := c.LinodeResize(1139016, 2)
	require.NoError(t, err)
}
开发者ID:alexsacr,项目名称:linode,代码行数:7,代码来源:api_linode_test.go


示例13: TestLinodeDeleteOK

func TestLinodeDeleteOK(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockLinodeDeleteOK()))
	defer ts.Close()

	err := c.LinodeDelete(1140616, Bool(true))
	require.NoError(t, err)
}
开发者ID:alexsacr,项目名称:linode,代码行数:7,代码来源:api_linode_test.go


示例14: TestWaitForAllJobsOK

func TestWaitForAllJobsOK(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockWaitForAllJobsOK()))
	defer ts.Close()

	err := c.WaitForAllJobs(1139016, 1*time.Nanosecond, 1*time.Second)
	require.NoError(t, err)
}
开发者ID:alexsacr,项目名称:linode,代码行数:7,代码来源:api_linode_test.go


示例15: TestNodeBalancerUpdateOK

func TestNodeBalancerUpdateOK(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockNodeBalancerUpdateOK()))
	defer ts.Close()

	err := c.NodeBalancerUpdate(13128, String("testing-2"), Int(10))
	require.NoError(t, err)
}
开发者ID:alexsacr,项目名称:linode,代码行数:7,代码来源:api_nodebalancer_test.go


示例16: TestUnmarshalSingleBool

func TestUnmarshalSingleBool(t *testing.T) {
	// doesn't currently get exercised in normal usage
	var out bool
	err := unmarshalSingle(json.RawMessage([]byte(`{"foo": true}`)), "foo", &out)
	require.NoError(t, err)
	assert.True(t, out)
}
开发者ID:alexsacr,项目名称:linode,代码行数:7,代码来源:marshal_test.go


示例17: TestLinodeConfigDeleteOK

func TestLinodeConfigDeleteOK(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockLinodeConfigDeleteOK()))
	defer ts.Close()

	err := c.LinodeConfigDelete(1146666, 1862591)
	require.NoError(t, err)
}
开发者ID:alexsacr,项目名称:linode,代码行数:7,代码来源:api_linode_test.go


示例18: TestAvailDistributionsIntegration

func TestAvailDistributionsIntegration(t *testing.T) {
	c := NewClient(apiKey)

	dists, err := c.AvailDistributions(nil)
	require.NoError(t, err)
	require.NotEmpty(t, dists)

	testDistsNotEmpty(t, dists)

	dists, err = c.AvailDistributions(Int(130))
	assert.NoError(t, err)
	assert.Len(t, dists, 1)

	d := dists[0]
	assert.Equal(t, true, d.RequiresPVOps, "d.RequiresPVOps")
	assert.Equal(t, 130, d.ID, "d.ID")
	assert.Equal(t, true, d.Is64Bit, "d.Is64Bit")
	assert.Equal(t, "Debian 7", d.Label, "d.Label")
	assert.Equal(t, 600, d.MinImageSize, "d.MinImageSize")
	assert.Equal(t, "2014-09-24 13:59:32.0", d.CreateDT, "d.CreateDT")

	dists, err = c.AvailDistributions(Int(38201938))
	assert.NoError(t, err)
	assert.Empty(t, dists)
}
开发者ID:alexsacr,项目名称:linode,代码行数:25,代码来源:integration_test.go


示例19: TestAvailDatacentersIntegration

func TestAvailDatacentersIntegration(t *testing.T) {
	c := NewClient(apiKey)

	datacenters, err := c.AvailDatacenters()
	require.NoError(t, err)
	require.NotEmpty(t, datacenters)

	// Test subset
	var foundDallas bool
	var foundFremont bool

	for _, dc := range datacenters {
		switch dc.ID {
		case 2:
			assert.Equal(t, "Dallas, TX, USA", dc.Location, "dc.Location")
			assert.Equal(t, "dallas", dc.Abbr, "dc.Abbr")
			foundDallas = true
		case 3:
			assert.Equal(t, "Fremont, CA, USA", dc.Location, "dc.Location")
			assert.Equal(t, "fremont", dc.Abbr, "dc.Abbr")
			foundFremont = true
		}
	}

	assert.True(t, foundDallas, "Dallas not returned.")
	assert.True(t, foundFremont, "Fremont not returned.")
}
开发者ID:alexsacr,项目名称:linode,代码行数:27,代码来源:integration_test.go


示例20: TestEchoOK

func TestEchoOK(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockTestEchoOK()))
	defer ts.Close()

	err := c.TestEcho()
	require.NoError(t, err)
}
开发者ID:alexsacr,项目名称:linode,代码行数:7,代码来源:api_utility_test.go



注:本文中的github.com/alexsacr/linode/_third_party/testify/require.NoError函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang client.GhostClient类代码示例发布时间:2022-05-24
下一篇:
Golang require.Len函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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