config

package
v5.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 9 Imported by: 0

Documentation

Overview

Package config provides testing helpers for Traffic Ops API tests.

Index

Constants

View Source
const (
	BadAssignmentMatch = iota + 1
	NotEnoughAssignments
	ExcessLabel
	InvalidLabel
	MissingLabel
	InvalidAction
	InvalidBool
	InvalidCacheCookieResponse
	InvalidHTTPScheme
	InvalidHost
	InvalidIP
	UnknownMethod
	InvalidIPRange
	InvalidPort
	InvalidRegex
	InvalidTimeFormatDHMS
	InvalidTimeRange24Hr
)

Error codes:

Variables

View Source
var ErrorContext *test.ErrorContext

ErrorContext contains the error codes mentioned above. Any error made must have one of those error codes.

Functions

func Validate24HrTimeRange

func Validate24HrTimeRange(rng string) error

Validate24HrTimeRange determines whether the provided string fits in a format such as "08:00-16:00".

func ValidateDHMSTimeFormat

func ValidateDHMSTimeFormat(time string) error

ValidateDHMSTimeFormat determines whether the provided string fits in a format such as "1d8h", where the valid units are days, hours, minutes, and seconds.

func ValidateIPRange

func ValidateIPRange(ip string) error

ValidateIPRange validates one of the following forms: 1) IP (supports shorthand of IPv4 and IPv6 addresses) 2) IP/n (CIDR) 3) IP1-IP2 where IP1 < IP2 and type(IP1) == type(IP2)

Types

type NegativeTest

type NegativeTest struct {
	Description string
	Config      string
	Expected    int
}

NegativeTest is a struct for table tests.

type PositiveTest

type PositiveTest struct {
	Description string
	Config      string
}

PositiveTest is a struct for table tests.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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