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


Golang require.NoError函数代码示例

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


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


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