testutils

package
v0.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func SameEndpoint

func SameEndpoint(a, b *endpoint.Endpoint) bool

SameEndpoint returns true if two endpoints are same considers example.org. and example.org DNSName/Target as different endpoints

func SameEndpoints

func SameEndpoints(a, b []*endpoint.Endpoint) bool

SameEndpoints compares two slices of endpoints regardless of order [x,y,z] == [z,x,y] [x,x,z] == [x,z,x] [x,y,y] != [x,x,y] [x,x,x] != [x,x,z]

Example
eps := []*endpoint.Endpoint{
	{
		DNSName: "example.org",
		Target:  "load-balancer.org",
	},
	{
		DNSName:    "example.org",
		Target:     "load-balancer.org",
		RecordType: "TXT",
	},
	{
		DNSName:    "abc.com",
		Target:     "something",
		RecordType: "TXT",
	},
	{
		DNSName:    "abc.com",
		Target:     "1.2.3.4",
		RecordType: "A",
	},
	{
		DNSName:    "bbc.com",
		Target:     "foo.com",
		RecordType: "CNAME",
	},
}
sort.Sort(byAllFields(eps))
for _, ep := range eps {
	fmt.Println(ep)
}
Output:

abc.com -> 1.2.3.4 (type "A")
abc.com -> something (type "TXT")
bbc.com -> foo.com (type "CNAME")
example.org -> load-balancer.org (type "")
example.org -> load-balancer.org (type "TXT")

func SamePlanChanges

func SamePlanChanges(a, b map[string][]*endpoint.Endpoint) bool

SamePlanChanges verifies that two set of changes are the same

Types

type MockSource added in v0.4.0

type MockSource struct {
	mock.Mock
}

MockSource returns mock endpoints.

func (*MockSource) Endpoints added in v0.4.0

func (m *MockSource) Endpoints() ([]*endpoint.Endpoint, error)

Endpoints returns the desired mock endpoints.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL