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
- Variables
- func DeleteTestCacheGroupParameter(t *testing.T, cgp tc.CacheGroupParameterRequest)
- func DeleteTestParameter(t *testing.T, pl tc.Parameter)
- func DeleteTestProfileParameter(t *testing.T, pp tc.ProfileParameter)
- func DeleteTestServerServerCapabilitiesForTopologies(t *testing.T)
- func DeleteTestServerServerCapabilitiesForTopologiesValidation(t *testing.T)
- func SetupAPICapabilities(db *sql.DB) error
- func SetupCapabilities(db *sql.DB) error
- func SetupJobs(db *sql.DB) error
- func SetupRoleCapabilities(db *sql.DB) error
- func SetupRoles(db *sql.DB) error
- func SetupTenants(db *sql.DB) error
- func SetupToExtensions(db *sql.DB) error
- func SetupTypes(db *sql.DB) error
- type TCData
- func (r *TCData) CreateTestBlankFields(t *testing.T)
- func (r *TCData) CreateTestCDNFederations(t *testing.T)
- func (r *TCData) CreateTestCDNs(t *testing.T)
- func (r *TCData) CreateTestCacheGroupParameters(t *testing.T)
- func (r *TCData) CreateTestCacheGroups(t *testing.T)
- func (r *TCData) CreateTestCachegroupsDeliveryServices(t *testing.T)
- func (r *TCData) CreateTestCoordinates(t *testing.T)
- func (r *TCData) CreateTestDeliveryServiceRequestComments(t *testing.T)
- func (r *TCData) CreateTestDeliveryServiceRequests(t *testing.T)
- func (r *TCData) CreateTestDeliveryServices(t *testing.T)
- func (r *TCData) CreateTestDeliveryServicesRegexes(t *testing.T)
- func (r *TCData) CreateTestDeliveryServicesRequiredCapabilities(t *testing.T)
- func (r *TCData) CreateTestDivisions(t *testing.T)
- func (r *TCData) CreateTestFederationResolvers(t *testing.T)
- func (r *TCData) CreateTestFederationUsers(t *testing.T)
- func (r *TCData) CreateTestInvalidFederationUsers(t *testing.T)
- func (r *TCData) CreateTestInvalidServerCheckExtensions(t *testing.T)
- func (r *TCData) CreateTestInvalidServerChecks(t *testing.T)
- func (r *TCData) CreateTestInvalidationJobs(t *testing.T)
- func (r *TCData) CreateTestOrigins(t *testing.T)
- func (r *TCData) CreateTestParameters(t *testing.T)
- func (r *TCData) CreateTestPhysLocations(t *testing.T)
- func (r *TCData) CreateTestProfileParameters(t *testing.T)
- func (r *TCData) CreateTestProfiles(t *testing.T)
- func (r *TCData) CreateTestRegions(t *testing.T)
- func (r *TCData) CreateTestRoles(t *testing.T)
- func (r *TCData) CreateTestServerCapabilities(t *testing.T)
- func (r *TCData) CreateTestServerCheckExtensions(t *testing.T)
- func (r *TCData) CreateTestServerChecks(t *testing.T)
- func (r *TCData) CreateTestServerServerCapabilities(t *testing.T)
- func (r *TCData) CreateTestServerWithoutProfileId(t *testing.T)
- func (r *TCData) CreateTestServers(t *testing.T)
- func (r *TCData) CreateTestServiceCategories(t *testing.T)
- func (r *TCData) CreateTestStaticDNSEntries(t *testing.T)
- func (r *TCData) CreateTestSteeringTargets(t *testing.T)
- func (r *TCData) CreateTestTenants(t *testing.T)
- func (r *TCData) CreateTestTopologies(t *testing.T)
- func (r *TCData) CreateTestTopologyBasedDeliveryServicesRequiredCapabilities(t *testing.T)
- func (r *TCData) CreateTestTypes(t *testing.T)
- func (r *TCData) CreateTestUsers(t *testing.T)
- func (r *TCData) CreateTestValidFederationUsers(t *testing.T)
- func (r *TCData) DeleteTestCDNFederations(t *testing.T)
- func (r *TCData) DeleteTestCDNs(t *testing.T)
- func (r *TCData) DeleteTestCacheGroupParameters(t *testing.T)
- func (r *TCData) DeleteTestCacheGroups(t *testing.T)
- func (r *TCData) DeleteTestCachegroupsDeliveryServices(t *testing.T)
- func (r *TCData) DeleteTestCoordinates(t *testing.T)
- func (r *TCData) DeleteTestDeliveryServiceRequestComments(t *testing.T)
- func (r *TCData) DeleteTestDeliveryServiceRequests(t *testing.T)
- func (r *TCData) DeleteTestDeliveryServices(t *testing.T)
- func (r *TCData) DeleteTestDeliveryServicesRegexes(t *testing.T)
- func (r *TCData) DeleteTestDeliveryServicesRequiredCapabilities(t *testing.T)
- func (r *TCData) DeleteTestDivisions(t *testing.T)
- func (r *TCData) DeleteTestFederationResolvers(t *testing.T)
- func (r *TCData) DeleteTestFederationUsers(t *testing.T)
- func (r *TCData) DeleteTestInvalidationJobs(t *testing.T)
- func (r *TCData) DeleteTestOrigins(t *testing.T)
- func (r *TCData) DeleteTestParameters(t *testing.T)
- func (r *TCData) DeleteTestParametersParallel(t *testing.T)
- func (r *TCData) DeleteTestPhysLocations(t *testing.T)
- func (r *TCData) DeleteTestProfileParameters(t *testing.T)
- func (r *TCData) DeleteTestProfileParametersParallel(t *testing.T)
- func (r *TCData) DeleteTestProfiles(t *testing.T)
- func (r *TCData) DeleteTestRegions(t *testing.T)
- func (r *TCData) DeleteTestRegionsByName(t *testing.T)
- func (r *TCData) DeleteTestRoles(t *testing.T)
- func (r *TCData) DeleteTestServerCapabilities(t *testing.T)
- func (r *TCData) DeleteTestServerCheckExtensions(t *testing.T)
- func (r *TCData) DeleteTestServerChecks(t *testing.T)
- func (r *TCData) DeleteTestServerServerCapabilities(t *testing.T)
- func (r *TCData) DeleteTestServers(t *testing.T)
- func (r *TCData) DeleteTestServiceCategories(t *testing.T)
- func (r *TCData) DeleteTestStaticDNSEntries(t *testing.T)
- func (r *TCData) DeleteTestSteeringTargets(t *testing.T)
- func (r *TCData) DeleteTestTenants(t *testing.T)
- func (r *TCData) DeleteTestTopologies(t *testing.T)
- func (r *TCData) DeleteTestTypes(t *testing.T)
- func (r *TCData) DeleteTestUsers(t *testing.T)
- func (r *TCData) ForceDeleteTestUsers(t *testing.T)
- func (r *TCData) LoadFixtures(fixturesPath string)
- func (r *TCData) OpenConnection() (*sql.DB, error)
- func (r *TCData) QueueUpdatesForServer(hostname string, queue bool) error
- func (r *TCData) SetupSession(toReqTimeout time.Duration, toURL string, toUser string, toPass string) error
- func (r *TCData) SetupSteeringTargets(t *testing.T)
- func (r *TCData) SetupTestData(*sql.DB) error
- func (r *TCData) SetupTmusers(db *sql.DB) error
- func (r *TCData) SwitchSession(toReqTimeout time.Duration, toURL string, toOldUser string, toOldPass string, ...) error
- func (r *TCData) Teardown(db *sql.DB) error
- func (r *TCData) TeardownSession(toReqTimeout time.Duration, toURL string, toUser string, toPass string) error
- func (r *TCData) WithObjs(t *testing.T, objs []TCObj, f func())
- type TCObj
- type TCObjFuncs
- type TrafficControl
Constants ¶
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 ¶
var ( TOSession *client.Session NoAuthTOSession *client.Session )
var SteeringUserSession *client.Session
Functions ¶
func DeleteTestParameter ¶
func SetupAPICapabilities ¶
func SetupCapabilities ¶
func SetupRoleCapabilities ¶
func SetupToExtensions ¶
SetupToExtensions setup open slot in to_extension table
Types ¶
type TCData ¶
type TCData struct { Config *config.Config TestData *TrafficControl }
func (*TCData) CreateTestBlankFields ¶
func (*TCData) CreateTestCDNFederations ¶
func (*TCData) CreateTestCDNs ¶
func (*TCData) CreateTestCacheGroupParameters ¶
func (*TCData) CreateTestCacheGroups ¶
func (*TCData) CreateTestCachegroupsDeliveryServices ¶
func (*TCData) CreateTestCoordinates ¶
func (*TCData) CreateTestDeliveryServiceRequestComments ¶
func (*TCData) CreateTestDeliveryServiceRequests ¶
func (*TCData) CreateTestDeliveryServices ¶
func (*TCData) CreateTestDeliveryServicesRegexes ¶
func (*TCData) CreateTestDeliveryServicesRequiredCapabilities ¶
func (*TCData) CreateTestDivisions ¶
func (*TCData) CreateTestFederationResolvers ¶
func (*TCData) CreateTestFederationUsers ¶
func (*TCData) CreateTestInvalidFederationUsers ¶
func (*TCData) CreateTestInvalidServerCheckExtensions ¶
func (*TCData) CreateTestInvalidServerChecks ¶
func (*TCData) CreateTestInvalidationJobs ¶
func (*TCData) CreateTestOrigins ¶
func (*TCData) CreateTestParameters ¶
func (*TCData) CreateTestPhysLocations ¶
func (*TCData) CreateTestProfileParameters ¶
func (*TCData) CreateTestProfiles ¶
func (*TCData) CreateTestRegions ¶
func (*TCData) CreateTestRoles ¶
func (*TCData) CreateTestServerCapabilities ¶
func (*TCData) CreateTestServerCheckExtensions ¶
func (*TCData) CreateTestServerChecks ¶
func (*TCData) CreateTestServerServerCapabilities ¶
func (*TCData) CreateTestServerWithoutProfileId ¶
func (*TCData) CreateTestServers ¶
func (*TCData) CreateTestServiceCategories ¶
func (*TCData) CreateTestStaticDNSEntries ¶
func (*TCData) CreateTestSteeringTargets ¶
func (*TCData) CreateTestTenants ¶
func (*TCData) CreateTestTopologies ¶
func (*TCData) CreateTestTopologyBasedDeliveryServicesRequiredCapabilities ¶
func (*TCData) CreateTestTypes ¶
func (*TCData) CreateTestUsers ¶
func (*TCData) CreateTestValidFederationUsers ¶
func (*TCData) DeleteTestCDNFederations ¶
func (*TCData) DeleteTestCDNs ¶
func (*TCData) DeleteTestCacheGroupParameters ¶
func (*TCData) DeleteTestCacheGroups ¶
func (*TCData) DeleteTestCachegroupsDeliveryServices ¶
func (*TCData) DeleteTestCoordinates ¶
func (*TCData) DeleteTestDeliveryServiceRequestComments ¶
func (*TCData) DeleteTestDeliveryServiceRequests ¶
func (*TCData) DeleteTestDeliveryServices ¶
func (*TCData) DeleteTestDeliveryServicesRegexes ¶
func (*TCData) DeleteTestDeliveryServicesRequiredCapabilities ¶
func (*TCData) DeleteTestDivisions ¶
func (*TCData) DeleteTestFederationResolvers ¶
func (*TCData) DeleteTestFederationUsers ¶
func (*TCData) DeleteTestInvalidationJobs ¶
func (*TCData) DeleteTestOrigins ¶
func (*TCData) DeleteTestParameters ¶
func (*TCData) DeleteTestParametersParallel ¶
func (*TCData) DeleteTestPhysLocations ¶
func (*TCData) DeleteTestProfileParameters ¶
func (*TCData) DeleteTestProfileParametersParallel ¶
func (*TCData) DeleteTestProfiles ¶
func (*TCData) DeleteTestRegions ¶
func (*TCData) DeleteTestRegionsByName ¶
func (*TCData) DeleteTestRoles ¶
func (*TCData) DeleteTestServerCapabilities ¶
func (*TCData) DeleteTestServerCheckExtensions ¶
func (*TCData) DeleteTestServerChecks ¶
Need to define no-op function as TCObj interface expects a delete function There is no delete path for serverchecks
func (*TCData) DeleteTestServerServerCapabilities ¶
func (*TCData) DeleteTestServers ¶
func (*TCData) DeleteTestServiceCategories ¶
func (*TCData) DeleteTestStaticDNSEntries ¶
func (*TCData) DeleteTestSteeringTargets ¶
func (*TCData) DeleteTestTenants ¶
func (*TCData) DeleteTestTopologies ¶
func (*TCData) DeleteTestTypes ¶
func (*TCData) DeleteTestUsers ¶
func (*TCData) ForceDeleteTestUsers ¶
ForceDeleteTestUsers forcibly deletes the users from the db.
func (*TCData) OpenConnection ¶
OpenConnection ...
func (*TCData) QueueUpdatesForServer ¶
func (*TCData) SetupSession ¶
func (*TCData) SetupSteeringTargets ¶
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 ¶
SetupTestData sets up initial data needed by the test suite to perform any tests.
func (*TCData) SwitchSession ¶
func (*TCData) TeardownSession ¶
func (*TCData) WithObjs ¶
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 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
Source Files ¶
- cachegroups.go
- cachegroups_parameters.go
- cachegroupsdeliveryservices.go
- cdnfederations.go
- cdns.go
- coordinates.go
- deliveryservice_request_comments.go
- deliveryservice_requests.go
- deliveryservices.go
- deliveryservices_required_capabilities.go
- deliveryservicesregexes.go
- divisions.go
- federation_resolvers.go
- federation_users.go
- fixtures.go
- invalidation_jobs.go
- origins.go
- parameters.go
- phys_locations.go
- profile_parameters.go
- profiles.go
- regions.go
- roles.go
- servercapabilities.go
- servercheckextension.go
- serverchecks.go
- servers.go
- serverservercapability.go
- servicecategories.go
- session.go
- staticdnsentries.go
- steeringtargets.go
- tcdata.go
- tenants.go
- todb.go
- topologies.go
- types.go
- user.go
- withobjs.go