tcdata

package
v7.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 20 Imported by: 0

Documentation

Overview

Package tcdata provides dynamic loading/unloading of ATC objects to/from a Traffic Ops instance.

This should ONLY be imported by tests, that's the library's only purpose.

Index

Constants

View Source
const TestEdgeServerCacheGroupName = "cachegroup3"

TODO this is the name hard-coded in the create servers test; change to be dynamic TODO this test assumes that a CDN named "cdn1" exists, has at least one Delivery Service, and also assumes that ALL SERVERS IN "cachegroup3" ARE EDGE-TIER CACHE SERVERS IN "cdn1". If that EVER changes, this WILL break.

Variables

View Source
var (
	TOSession       *client.Session
	NoAuthTOSession *client.Session
)
View Source
var SteeringUserSession *client.Session

Functions

func DeleteTestCacheGroupParameter

func DeleteTestCacheGroupParameter(t *testing.T, cgp tc.CacheGroupParameterRequest)

func DeleteTestParameter

func DeleteTestParameter(t *testing.T, pl tc.Parameter)

func DeleteTestProfileParameter

func DeleteTestProfileParameter(t *testing.T, pp tc.ProfileParameter)

func DeleteTestServerServerCapabilitiesForTopologies

func DeleteTestServerServerCapabilitiesForTopologies(t *testing.T)

func DeleteTestServerServerCapabilitiesForTopologiesValidation

func DeleteTestServerServerCapabilitiesForTopologiesValidation(t *testing.T)

func SetupAPICapabilities

func SetupAPICapabilities(db *sql.DB) error

func SetupCapabilities

func SetupCapabilities(db *sql.DB) error

func SetupJobs

func SetupJobs(db *sql.DB) error

SetupJobs ...

func SetupRoleCapabilities

func SetupRoleCapabilities(db *sql.DB) error

func SetupRoles

func SetupRoles(db *sql.DB) error

SetupRoles ...

func SetupTenants

func SetupTenants(db *sql.DB) error

SetupTenants ...

func SetupToExtensions

func SetupToExtensions(db *sql.DB) error

SetupToExtensions setup open slot in to_extension table

func SetupTypes

func SetupTypes(db *sql.DB) error

SetupTypes Set up to_extension types

Types

type TCData

type TCData struct {
	Config   *config.Config
	TestData *TrafficControl
}

func NewTCData

func NewTCData() *TCData

func (*TCData) CreateTestBlankFields

func (r *TCData) CreateTestBlankFields(t *testing.T)

func (*TCData) CreateTestCDNFederations

func (r *TCData) CreateTestCDNFederations(t *testing.T)

func (*TCData) CreateTestCDNs

func (r *TCData) CreateTestCDNs(t *testing.T)

func (*TCData) CreateTestCacheGroupParameters

func (r *TCData) CreateTestCacheGroupParameters(t *testing.T)

func (*TCData) CreateTestCacheGroups

func (r *TCData) CreateTestCacheGroups(t *testing.T)

func (*TCData) CreateTestCachegroupsDeliveryServices

func (r *TCData) CreateTestCachegroupsDeliveryServices(t *testing.T)

func (*TCData) CreateTestCoordinates

func (r *TCData) CreateTestCoordinates(t *testing.T)

func (*TCData) CreateTestDeliveryServiceRequestComments

func (r *TCData) CreateTestDeliveryServiceRequestComments(t *testing.T)

func (*TCData) CreateTestDeliveryServiceRequests

func (r *TCData) CreateTestDeliveryServiceRequests(t *testing.T)

func (*TCData) CreateTestDeliveryServices

func (r *TCData) CreateTestDeliveryServices(t *testing.T)

func (*TCData) CreateTestDeliveryServicesRegexes

func (r *TCData) CreateTestDeliveryServicesRegexes(t *testing.T)

func (*TCData) CreateTestDeliveryServicesRequiredCapabilities

func (r *TCData) CreateTestDeliveryServicesRequiredCapabilities(t *testing.T)

func (*TCData) CreateTestDivisions

func (r *TCData) CreateTestDivisions(t *testing.T)

func (*TCData) CreateTestFederationResolvers

func (r *TCData) CreateTestFederationResolvers(t *testing.T)

func (*TCData) CreateTestFederationUsers

func (r *TCData) CreateTestFederationUsers(t *testing.T)

func (*TCData) CreateTestInvalidFederationUsers

func (r *TCData) CreateTestInvalidFederationUsers(t *testing.T)

func (*TCData) CreateTestInvalidServerCheckExtensions

func (r *TCData) CreateTestInvalidServerCheckExtensions(t *testing.T)

func (*TCData) CreateTestInvalidServerChecks

func (r *TCData) CreateTestInvalidServerChecks(t *testing.T)

func (*TCData) CreateTestInvalidationJobs

func (r *TCData) CreateTestInvalidationJobs(t *testing.T)

func (*TCData) CreateTestOrigins

func (r *TCData) CreateTestOrigins(t *testing.T)

func (*TCData) CreateTestParameters

func (r *TCData) CreateTestParameters(t *testing.T)

func (*TCData) CreateTestPhysLocations

func (r *TCData) CreateTestPhysLocations(t *testing.T)

func (*TCData) CreateTestProfileParameters

func (r *TCData) CreateTestProfileParameters(t *testing.T)

func (*TCData) CreateTestProfiles

func (r *TCData) CreateTestProfiles(t *testing.T)

func (*TCData) CreateTestRegions

func (r *TCData) CreateTestRegions(t *testing.T)

func (*TCData) CreateTestRoles

func (r *TCData) CreateTestRoles(t *testing.T)

func (*TCData) CreateTestServerCapabilities

func (r *TCData) CreateTestServerCapabilities(t *testing.T)

func (*TCData) CreateTestServerCheckExtensions

func (r *TCData) CreateTestServerCheckExtensions(t *testing.T)

func (*TCData) CreateTestServerChecks

func (r *TCData) CreateTestServerChecks(t *testing.T)

func (*TCData) CreateTestServerServerCapabilities

func (r *TCData) CreateTestServerServerCapabilities(t *testing.T)

func (*TCData) CreateTestServerWithoutProfileId

func (r *TCData) CreateTestServerWithoutProfileId(t *testing.T)

func (*TCData) CreateTestServers

func (r *TCData) CreateTestServers(t *testing.T)

func (*TCData) CreateTestServiceCategories

func (r *TCData) CreateTestServiceCategories(t *testing.T)

func (*TCData) CreateTestStaticDNSEntries

func (r *TCData) CreateTestStaticDNSEntries(t *testing.T)

func (*TCData) CreateTestSteeringTargets

func (r *TCData) CreateTestSteeringTargets(t *testing.T)

func (*TCData) CreateTestTenants

func (r *TCData) CreateTestTenants(t *testing.T)

func (*TCData) CreateTestTopologies

func (r *TCData) CreateTestTopologies(t *testing.T)

func (*TCData) CreateTestTopologyBasedDeliveryServicesRequiredCapabilities

func (r *TCData) CreateTestTopologyBasedDeliveryServicesRequiredCapabilities(t *testing.T)

func (*TCData) CreateTestTypes

func (r *TCData) CreateTestTypes(t *testing.T)

func (*TCData) CreateTestUsers

func (r *TCData) CreateTestUsers(t *testing.T)

func (*TCData) CreateTestValidFederationUsers

func (r *TCData) CreateTestValidFederationUsers(t *testing.T)

func (*TCData) DeleteTestCDNFederations

func (r *TCData) DeleteTestCDNFederations(t *testing.T)

func (*TCData) DeleteTestCDNs

func (r *TCData) DeleteTestCDNs(t *testing.T)

func (*TCData) DeleteTestCacheGroupParameters

func (r *TCData) DeleteTestCacheGroupParameters(t *testing.T)

func (*TCData) DeleteTestCacheGroups

func (r *TCData) DeleteTestCacheGroups(t *testing.T)

func (*TCData) DeleteTestCachegroupsDeliveryServices

func (r *TCData) DeleteTestCachegroupsDeliveryServices(t *testing.T)

func (*TCData) DeleteTestCoordinates

func (r *TCData) DeleteTestCoordinates(t *testing.T)

func (*TCData) DeleteTestDeliveryServiceRequestComments

func (r *TCData) DeleteTestDeliveryServiceRequestComments(t *testing.T)

func (*TCData) DeleteTestDeliveryServiceRequests

func (r *TCData) DeleteTestDeliveryServiceRequests(t *testing.T)

func (*TCData) DeleteTestDeliveryServices

func (r *TCData) DeleteTestDeliveryServices(t *testing.T)

func (*TCData) DeleteTestDeliveryServicesRegexes

func (r *TCData) DeleteTestDeliveryServicesRegexes(t *testing.T)

func (*TCData) DeleteTestDeliveryServicesRequiredCapabilities

func (r *TCData) DeleteTestDeliveryServicesRequiredCapabilities(t *testing.T)

func (*TCData) DeleteTestDivisions

func (r *TCData) DeleteTestDivisions(t *testing.T)

func (*TCData) DeleteTestFederationResolvers

func (r *TCData) DeleteTestFederationResolvers(t *testing.T)

func (*TCData) DeleteTestFederationUsers

func (r *TCData) DeleteTestFederationUsers(t *testing.T)

func (*TCData) DeleteTestInvalidationJobs

func (r *TCData) DeleteTestInvalidationJobs(t *testing.T)

func (*TCData) DeleteTestOrigins

func (r *TCData) DeleteTestOrigins(t *testing.T)

func (*TCData) DeleteTestParameters

func (r *TCData) DeleteTestParameters(t *testing.T)

func (*TCData) DeleteTestParametersParallel

func (r *TCData) DeleteTestParametersParallel(t *testing.T)

func (*TCData) DeleteTestPhysLocations

func (r *TCData) DeleteTestPhysLocations(t *testing.T)

func (*TCData) DeleteTestProfileParameters

func (r *TCData) DeleteTestProfileParameters(t *testing.T)

func (*TCData) DeleteTestProfileParametersParallel

func (r *TCData) DeleteTestProfileParametersParallel(t *testing.T)

func (*TCData) DeleteTestProfiles

func (r *TCData) DeleteTestProfiles(t *testing.T)

func (*TCData) DeleteTestRegions

func (r *TCData) DeleteTestRegions(t *testing.T)

func (*TCData) DeleteTestRegionsByName

func (r *TCData) DeleteTestRegionsByName(t *testing.T)

func (*TCData) DeleteTestRoles

func (r *TCData) DeleteTestRoles(t *testing.T)

func (*TCData) DeleteTestServerCapabilities

func (r *TCData) DeleteTestServerCapabilities(t *testing.T)

func (*TCData) DeleteTestServerCheckExtensions

func (r *TCData) DeleteTestServerCheckExtensions(t *testing.T)

func (*TCData) DeleteTestServerChecks

func (r *TCData) DeleteTestServerChecks(t *testing.T)

Need to define no-op function as TCObj interface expects a delete function There is no delete path for serverchecks

func (*TCData) DeleteTestServerServerCapabilities

func (r *TCData) DeleteTestServerServerCapabilities(t *testing.T)

func (*TCData) DeleteTestServers

func (r *TCData) DeleteTestServers(t *testing.T)

func (*TCData) DeleteTestServiceCategories

func (r *TCData) DeleteTestServiceCategories(t *testing.T)

func (*TCData) DeleteTestStaticDNSEntries

func (r *TCData) DeleteTestStaticDNSEntries(t *testing.T)

func (*TCData) DeleteTestSteeringTargets

func (r *TCData) DeleteTestSteeringTargets(t *testing.T)

func (*TCData) DeleteTestTenants

func (r *TCData) DeleteTestTenants(t *testing.T)

func (*TCData) DeleteTestTopologies

func (r *TCData) DeleteTestTopologies(t *testing.T)

func (*TCData) DeleteTestTypes

func (r *TCData) DeleteTestTypes(t *testing.T)

func (*TCData) DeleteTestUsers

func (r *TCData) DeleteTestUsers(t *testing.T)

func (*TCData) ForceDeleteTestUsers

func (r *TCData) ForceDeleteTestUsers(t *testing.T)

ForceDeleteTestUsers forcibly deletes the users from the db.

func (*TCData) LoadFixtures

func (r *TCData) LoadFixtures(fixturesPath string)

LoadFixtures ...

func (*TCData) OpenConnection

func (r *TCData) OpenConnection() (*sql.DB, error)

OpenConnection ...

func (*TCData) QueueUpdatesForServer

func (r *TCData) QueueUpdatesForServer(hostname string, queue bool) error

func (*TCData) SetupSession

func (r *TCData) SetupSession(toReqTimeout time.Duration, toURL string, toUser string, toPass string) error

func (*TCData) SetupSteeringTargets

func (r *TCData) SetupSteeringTargets(t *testing.T)

SetupSteeringTargets calls the CreateSteeringTargets test. It also sets the steering user session with the logged in steering user. SteeringUserSession is used by steering target test functions. Running this function depends on CreateTestUsers.

func (*TCData) SetupTestData

func (r *TCData) SetupTestData(*sql.DB) error

SetupTestData sets up initial data needed by the test suite to perform any tests.

func (*TCData) SetupTmusers

func (r *TCData) SetupTmusers(db *sql.DB) error

SetupTmusers ...

func (*TCData) SwitchSession

func (r *TCData) SwitchSession(toReqTimeout time.Duration, toURL string, toOldUser string, toOldPass string, toNewUser string, toNewPass string) error

func (*TCData) Teardown

func (r *TCData) Teardown(db *sql.DB) error

Teardown - ensures that the data is cleaned up for a fresh run

func (*TCData) TeardownSession

func (r *TCData) TeardownSession(toReqTimeout time.Duration, toURL string, toUser string, toPass string) error

func (*TCData) WithObjs

func (r *TCData) WithObjs(t *testing.T, objs []TCObj, f func())

WithObjs creates the objs in order, runs f, and defers deleting the objs in the same order.

Because deletion is deferred, using this ensures objects will be cleaned up if f panics or calls t.Fatal, as much as possible.

Note that f itself may still create things which are not cleaned up properly, and likewise, the object creation and deletion tests themselves may fail. All tests in the Traffic Ops API Testing framework use the same Traffic Ops instance, with persistent data. Because of this, when any test fails, all subsequent tests should be considered invalid, irrespective whether they pass or fail. Users are encouraged to use `go test -failfast`.

type TCObj

type TCObj int
const (
	CacheGroups TCObj = iota
	CacheGroupsDeliveryServices
	CacheGroupParameters
	CDNs
	CDNFederations
	Coordinates
	DeliveryServices
	DeliveryServicesRegexes
	DeliveryServiceRequests
	DeliveryServiceRequestComments
	DeliveryServicesRequiredCapabilities
	Divisions
	FederationResolvers
	FederationUsers
	InvalidationJobs
	Origins
	Parameters
	PhysLocations
	Profiles
	ProfileParameters
	Regions
	Roles
	ServerCapabilities
	ServerChecks
	ServerServerCapabilities
	Servers
	ServiceCategories
	StaticDNSEntries
	SteeringTargets
	Tenants
	ServerCheckExtensions
	Topologies
	Types
	Users
)

type TCObjFuncs

type TCObjFuncs struct {
	Create func(t *testing.T)
	Delete func(t *testing.T)
}

type TrafficControl

type TrafficControl struct {
	ASNs                                              []tc.ASN                                `json:"asns"`
	CDNs                                              []tc.CDN                                `json:"cdns"`
	CacheGroups                                       []tc.CacheGroupNullable                 `json:"cachegroups"`
	CacheGroupParameterRequests                       []tc.CacheGroupParameterRequest         `json:"cachegroupParameters"`
	Capabilities                                      []tc.Capability                         `json:"capability"`
	Coordinates                                       []tc.Coordinate                         `json:"coordinates"`
	DeliveryServicesRegexes                           []tc.DeliveryServiceRegexesTest         `json:"deliveryServicesRegexes"`
	DeliveryServiceRequests                           []tc.DeliveryServiceRequest             `json:"deliveryServiceRequests"`
	DeliveryServiceRequestComments                    []tc.DeliveryServiceRequestComment      `json:"deliveryServiceRequestComments"`
	DeliveryServices                                  []tc.DeliveryServiceNullableV30         `json:"deliveryservices"`
	DeliveryServicesRequiredCapabilities              []tc.DeliveryServicesRequiredCapability `json:"deliveryservicesRequiredCapabilities"`
	TopologyBasedDeliveryServicesRequiredCapabilities []tc.DeliveryServicesRequiredCapability `json:"topologyBasedDeliveryServicesRequiredCapabilities"`
	Divisions                                         []tc.Division                           `json:"divisions"`
	Federations                                       []tc.CDNFederation                      `json:"federations"`
	FederationResolvers                               []tc.FederationResolver                 `json:"federation_resolvers"`
	InvalidationJobs                                  []tc.InvalidationJobInput               `json:"invalidationJobs"`
	Origins                                           []tc.Origin                             `json:"origins"`
	Profiles                                          []tc.Profile                            `json:"profiles"`
	Parameters                                        []tc.Parameter                          `json:"parameters"`
	ProfileParameters                                 []tc.ProfileParameter                   `json:"profileParameters"`
	PhysLocations                                     []tc.PhysLocation                       `json:"physLocations"`
	Regions                                           []tc.Region                             `json:"regions"`
	Roles                                             []tc.Role                               `json:"roles"`
	Servers                                           []tc.ServerV30                          `json:"servers"`
	ServerServerCapabilities                          []tc.ServerServerCapability             `json:"serverServerCapabilities"`
	ServerCapabilities                                []tc.ServerCapability                   `json:"serverCapabilities"`
	ServiceCategories                                 []tc.ServiceCategory                    `json:"serviceCategories"`
	Statuses                                          []tc.StatusNullable                     `json:"statuses"`
	StaticDNSEntries                                  []tc.StaticDNSEntry                     `json:"staticdnsentries"`
	StatsSummaries                                    []tc.StatsSummary                       `json:"statsSummaries"`
	Tenants                                           []tc.Tenant                             `json:"tenants"`
	ServerCheckExtensions                             []tc.ServerCheckExtensionNullable       `json:"servercheck_extensions"`
	Topologies                                        []tc.Topology                           `json:"topologies"`
	Types                                             []tc.Type                               `json:"types"`
	SteeringTargets                                   []tc.SteeringTargetNullable             `json:"steeringTargets"`
	Serverchecks                                      []tc.ServercheckRequestNullable         `json:"serverchecks"`
	Users                                             []tc.User                               `json:"users"`
}

TrafficControl - maps to the tc-fixtures.json file

Jump to

Keyboard shortcuts

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