testutils

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2017 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var EgressRule1 = api.Rule{
	Action:    "pass",
	IPVersion: &ipv4,
	Protocol:  &numProtocol1,
	ICMP:      &icmp1,
	Source: api.EntityRule{
		Tag:      "tag3",
		Net:      &cidr2,
		Selector: "all()",
	},
}
View Source
var EgressRule2 = api.Rule{
	Action:    "allow",
	IPVersion: &ipv6,
	Protocol:  &strProtocol2,
	ICMP:      &icmp1,
	Source: api.EntityRule{
		Tag:      "tag4",
		Net:      &cidrv62,
		Selector: "label2 == '1234'",
	},
}
View Source
var InRule1 = api.Rule{
	Action:    "allow",
	IPVersion: &ipv4,
	Protocol:  &strProtocol1,
	ICMP:      &icmp1,
	Source: api.EntityRule{
		Tag:      "tag1",
		Net:      &cidr1,
		Selector: "label1 == 'value1'",
	},
}
View Source
var InRule2 = api.Rule{
	Action:    "deny",
	IPVersion: &ipv6,
	Protocol:  &numProtocol1,
	ICMP:      &icmp1,
	Source: api.EntityRule{
		Tag:      "tag2",
		Net:      &cidrv61,
		Selector: "has(label2)",
	},
}

Functions

func CleanDatastore added in v1.3.0

func CleanDatastore(config api.CalicoAPIConfig)

func CleanIPPools added in v1.1.1

func CleanIPPools(c *client.Client)

func CreateCleanClient added in v1.3.0

func CreateCleanClient(config api.CalicoAPIConfig) *client.Client

CreateCleanClient is a utility function to wipe clean "/calico" recursively from backend and to return confugred client to it

func CreateClient added in v1.3.0

func CreateClient(config api.CalicoAPIConfig) *client.Client

func CreateNewIPPool

func CreateNewIPPool(c client.Client, poolSubnet string, ipip, natOut, ipam bool)

CreateNewIPPool takes a client.Client with a poolSubnet CIDR (in "192.168.1.0/24" format) with ipip, natOut, and ipam bools for the pool to be setup and creates a new pool.

func CreateRule

func CreateRule(ipv, icmpType, icmpCode int, proto, cidrStr, tag, selector, inAction, eAction string) (api.Rule, api.Rule)

CreateRule takes all fields necessary to create a api.Rule object and returns ingress and egress api.Rules.

func DumpDatastore added in v1.3.0

func DumpDatastore(config api.CalicoAPIConfig) error

DumpDatastore prints out a recursive dump of the contents of backend.

func E2eDatastoreDescribe added in v1.1.1

func E2eDatastoreDescribe(description string, datastores DatastoreType, body func(config api.CalicoAPIConfig)) bool

E2eDatastoreDescribe is a replacement for ginkgo.Describe which invokes Describe multiple times for one or more different datastore drivers - passing in the Calico API configuration as a parameter to the test function. This allows easy construction of end-to-end tests covering multiple different datastore drivers.

The *datastores* parameter is a bit-wise OR of the required datastore drivers that will be tested.

func HookLogrusForGinkgo

func HookLogrusForGinkgo()

func MustParseCIDR

func MustParseCIDR(c string) net.IPNet

MustParseCIDR parses the string into a net.IPNet. The IP address in the IPNet is not masked.

func MustParseIP

func MustParseIP(i string) net.IP

func MustParseNetwork added in v1.1.1

func MustParseNetwork(c string) net.IPNet

MustParseNetwork parses the string into a net.IPNet. The IP address in the IPNet is masked.

Types

type DatastoreType added in v1.3.0

type DatastoreType int
const (
	DatastoreEtcdV2 DatastoreType = 1 << iota
	DatastoreK8s

	DatastoreAll = DatastoreEtcdV2 | DatastoreK8s
)

Jump to

Keyboard shortcuts

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