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

Golang testhelpers.CheckOneMultiError函数代码示例

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

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



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

示例1: TestManageRoutesSpecValidateMissingCidr

func TestManageRoutesSpecValidateMissingCidr(t *testing.T) {
	r := ManageRoutesSpec{
		Instance: "SELF",
	}
	err := r.Validate(im1, &FakeRouteTableManager{}, "foo", emptyHealthchecks, emptyHealthchecks)
	testhelpers.CheckOneMultiError(t, err, "cidr is not defined in foo")
}
开发者ID:somic,项目名称:AWSnycast,代码行数:7,代码来源:aws_test.go


示例2: TestHealthcheckValidateNoType

func TestHealthcheckValidateNoType(t *testing.T) {
	h := Healthcheck{
		Destination: "127.0.0.1",
	}
	err := h.Validate("foo", false)
	testhelpers.CheckOneMultiError(t, err, "No healthcheck type set")
}
开发者ID:somic,项目名称:AWSnycast,代码行数:7,代码来源:healthcheck_test.go


示例3: TestRouteTableFindSpecValidateNoConfig

func TestRouteTableFindSpecValidateNoConfig(t *testing.T) {
	r := RouteTableFindSpec{
		Type: "by_tag",
	}
	err := r.Validate("foo")
	testhelpers.CheckOneMultiError(t, err, "Route find spec foo needs config")
}
开发者ID:tsheasha,项目名称:AWSnycast,代码行数:7,代码来源:config_test.go


示例4: TestHealthcheckValidateFailNoDestination

func TestHealthcheckValidateFailNoDestination(t *testing.T) {
	h := Healthcheck{
		Type: "ping",
	}
	err := h.Validate("foo", false)
	testhelpers.CheckOneMultiError(t, err, "Healthcheck foo has no destination set")
}
开发者ID:somic,项目名称:AWSnycast,代码行数:7,代码来源:healthcheck_test.go


示例5: TestGetFiltersListForSpecWrongType

func TestGetFiltersListForSpecWrongType(t *testing.T) {
	c := make(map[string]interface{})
	c["filters"] = "foo"
	spec := RouteTableFindSpec{Config: c}
	_, err := getFiltersListForSpec(spec)
	testhelpers.CheckOneMultiError(t, err, "unexpected type string for 'filters' key")
}
开发者ID:tsheasha,项目名称:AWSnycast,代码行数:7,代码来源:config_test.go


示例6: TestConfigValidateEmptyRouteTables

func TestConfigValidateEmptyRouteTables(t *testing.T) {
	r := make(map[string]*RouteTable)
	c := Config{
		RouteTables: r,
	}
	err := c.Validate(tim, rtm)
	testhelpers.CheckOneMultiError(t, err, "No route_tables defined in config")
}
开发者ID:tsheasha,项目名称:AWSnycast,代码行数:8,代码来源:config_test.go


示例7: TestHealthcheckValidateRemoteWithDestFails

func TestHealthcheckValidateRemoteWithDestFails(t *testing.T) {
	h := Healthcheck{
		Type:        "ping",
		Destination: "127.0.0.1",
	}
	err := h.Validate("foo", true)
	testhelpers.CheckOneMultiError(t, err, "Remote healthcheck foo cannot have destination set")
}
开发者ID:somic,项目名称:AWSnycast,代码行数:8,代码来源:healthcheck_test.go


示例8: TestHealthcheckValidateFailDestination

func TestHealthcheckValidateFailDestination(t *testing.T) {
	h := Healthcheck{
		Type:        "ping",
		Destination: "www.google.com",
	}
	err := h.Validate("foo", false)
	testhelpers.CheckOneMultiError(t, err, "Healthcheck foo destination 'www.google.com' does not parse as an IP address")
}
开发者ID:somic,项目名称:AWSnycast,代码行数:8,代码来源:healthcheck_test.go


示例9: TestHealthcheckValidateFailType

func TestHealthcheckValidateFailType(t *testing.T) {
	h := Healthcheck{
		Type:        "notping",
		Destination: "127.0.0.1",
	}
	err := h.Validate("foo", false)
	testhelpers.CheckOneMultiError(t, err, "Unknown healthcheck type 'notping' in foo")
}
开发者ID:somic,项目名称:AWSnycast,代码行数:8,代码来源:healthcheck_test.go


示例10: TestManageRoutesSpecValidateBadCidr3

func TestManageRoutesSpecValidateBadCidr3(t *testing.T) {
	r := ManageRoutesSpec{
		Cidr:     "foo",
		Instance: "SELF",
	}
	err := r.Validate(im1, &FakeRouteTableManager{}, "bar", emptyHealthchecks, emptyHealthchecks)
	testhelpers.CheckOneMultiError(t, err, "Could not parse invalid CIDR address: foo/32 in bar")
}
开发者ID:somic,项目名称:AWSnycast,代码行数:8,代码来源:aws_test.go


示例11: TestManageRoutesSpecValidateMissingRemoteHealthcheck

func TestManageRoutesSpecValidateMissingRemoteHealthcheck(t *testing.T) {
	r := ManageRoutesSpec{
		Cidr:                  "0.0.0.0/0",
		Instance:              "SELF",
		RemoteHealthcheckName: "test",
	}
	err := r.Validate(im1, &FakeRouteTableManager{}, "foo", emptyHealthchecks, emptyHealthchecks)
	testhelpers.CheckOneMultiError(t, err, "Route tables foo, route 0.0.0.0/0 cannot find remote healthcheck 'test'")
}
开发者ID:somic,项目名称:AWSnycast,代码行数:9,代码来源:aws_test.go


示例12: TestUpdateRemoteHealthchecksEmpty

func TestUpdateRemoteHealthchecksEmpty(t *testing.T) {
	rs := &ManageRoutesSpec{
		Cidr: "127.0.0.1",
		RemoteHealthcheckName: "test",
	}
	err := rs.Validate(im1, &FakeRouteTableManager{}, "foo", emptyHealthchecks, emptyHealthchecks)
	testhelpers.CheckOneMultiError(t, err, "Route tables foo, route 127.0.0.1/32 cannot find remote healthcheck 'test'")
	rs.UpdateRemoteHealthchecks()
}
开发者ID:somic,项目名称:AWSnycast,代码行数:9,代码来源:aws_test.go


示例13: TestRouteTableFindSpecValidateNoType

func TestRouteTableFindSpecValidateNoType(t *testing.T) {
	c := make(map[string]interface{})
	c["key"] = "Name"
	c["value"] = "private a"
	r := RouteTableFindSpec{
		Config: c,
	}
	err := r.Validate("foo")
	testhelpers.CheckOneMultiError(t, err, "Route find spec foo needs a type key")
}
开发者ID:tsheasha,项目名称:AWSnycast,代码行数:10,代码来源:config_test.go


示例14: TestByTagRouteTableFindMissingValue

func TestByTagRouteTableFindMissingValue(t *testing.T) {
	c := make(map[string]interface{})
	c["key"] = "Name"
	rts := RouteTableFindSpec{
		Type:   "by_tag",
		Config: c,
	}
	rtf, err := rts.GetFilter()
	assert.Nil(t, rtf)
	testhelpers.CheckOneMultiError(t, err, "No value in config for by_tag route table finder")
}
开发者ID:tsheasha,项目名称:AWSnycast,代码行数:11,代码来源:config_test.go


示例15: TestRouteTableFindSpecValidateUnknownType

func TestRouteTableFindSpecValidateUnknownType(t *testing.T) {
	c := make(map[string]interface{})
	c["key"] = "Name"
	c["value"] = "private a"
	r := RouteTableFindSpec{
		Type:   "doesnotexist",
		Config: c,
	}
	err := r.Validate("foo")
	testhelpers.CheckOneMultiError(t, err, "Route find spec foo type 'doesnotexist' not known")
}
开发者ID:tsheasha,项目名称:AWSnycast,代码行数:11,代码来源:config_test.go


示例16: TestConfigValidateBadHealthChecks

func TestConfigValidateBadHealthChecks(t *testing.T) {
	c_disk, _ := New("../tests/awsnycast.yaml", tim, rtm)
	c := Config{
		RouteTables:  c_disk.RouteTables,
		Healthchecks: c_disk.Healthchecks,
	}
	c.Healthchecks["foo"] = &healthcheck.Healthcheck{Type: "tcp"}
	c.Healthchecks["foo"].Validate("foo", false)
	err := c.Validate(tim, rtm)
	testhelpers.CheckOneMultiError(t, err, "Healthcheck foo has no destination set")
}
开发者ID:tsheasha,项目名称:AWSnycast,代码行数:11,代码来源:config_test.go


示例17: TestHealthcheckTcpNoPort

func TestHealthcheckTcpNoPort(t *testing.T) {
	c := make(map[string]interface{})
	c["send"] = "HEAD / HTTP/1.0\r\n\r\n"
	c["expect"] = "200 OK"
	h := Healthcheck{
		Type:        "tcp",
		Destination: "127.0.0.1",
		Config:      c,
	}
	h.Validate("foo", false)
	err := h.Setup()
	if assert.NotNil(t, err) {
		testhelpers.CheckOneMultiError(t, err, "'port' not defined in tcp healthcheck config to 127.0.0.1")
	}
}
开发者ID:tsheasha,项目名称:AWSnycast,代码行数:15,代码来源:tcp_test.go


示例18: TestRouteTableValidateNoRoutes

func TestRouteTableValidateNoRoutes(t *testing.T) {
	c := make(map[string]interface{})
	c["key"] = "Name"
	c["value"] = "private a"
	rfs := RouteTableFindSpec{
		Type:   "by_tag",
		Config: c,
	}
	r := RouteTable{
		Find:         rfs,
		ManageRoutes: make([]*aws.ManageRoutesSpec, 0),
	}
	err := r.Validate(tim, rtm, "foo", emptyHealthchecks, emptyHealthchecks)
	testhelpers.CheckOneMultiError(t, err, "No manage_routes key in route table 'foo'")
}
开发者ID:tsheasha,项目名称:AWSnycast,代码行数:15,代码来源:config_test.go


示例19: TestConfigValidateBadRouteTables

func TestConfigValidateBadRouteTables(t *testing.T) {
	r := make(map[string]*RouteTable)
	conf := make(map[string]interface{})
	conf["key"] = "foo"
	conf["value"] = "foo"
	r["foo"] = &RouteTable{
		Find: RouteTableFindSpec{
			Type:   "by_tag",
			Config: conf,
		},
	}
	c := Config{
		RouteTables: r,
	}
	err := c.Validate(tim, rtm)
	testhelpers.CheckOneMultiError(t, err, "No manage_routes key in route table 'foo'")
}
开发者ID:tsheasha,项目名称:AWSnycast,代码行数:17,代码来源:config_test.go


示例20: TestConfigValidateBadRouteTableUpserts

func TestConfigValidateBadRouteTableUpserts(t *testing.T) {
	r := make(map[string]*RouteTable)
	urs := make([]*aws.ManageRoutesSpec, 1)
	c := make(map[string]interface{})
	c["key"] = "foo"
	c["value"] = "bar"
	urs[0] = &aws.ManageRoutesSpec{}
	r["foo"] = &RouteTable{
		Find: RouteTableFindSpec{
			Type:   "by_tag",
			Config: c,
		},
		ManageRoutes: urs,
	}
	conf := Config{
		RouteTables: r,
	}
	err := conf.Validate(tim, rtm)
	testhelpers.CheckOneMultiError(t, err, "cidr is not defined in foo")
}
开发者ID:tsheasha,项目名称:AWSnycast,代码行数:20,代码来源:config_test.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang writ.Path类代码示例发布时间:2022-05-24
下一篇:
Golang matrix.DenseMatrix类代码示例发布时间: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