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 ¶
- Variables
- 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
- func WrapClient(cl **toclient.Session, clF func(t *testing.T, toClient *toclient.Session)) func(t *testing.T)
- func WrapClientDat(cl **toclient.Session, dat *totest.TrafficControl, ...) func(t *testing.T)
- func WrapClientDatDB(r *TCData, cl **toclient.Session, dat *totest.TrafficControl, ...) func(t *testing.T)
- func WrapNewClientDat(r *TCData, dat *totest.TrafficControl, user *string, pass *string, ...) func(t *testing.T)
- type TCData
- 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) 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
Constants ¶
This section is empty.
Variables ¶
var ( TOSession *client.Session NoAuthTOSession *client.Session )
Functions ¶
func SetupAPICapabilities ¶
func SetupCapabilities ¶
func SetupRoleCapabilities ¶
func SetupToExtensions ¶
SetupToExtensions setup open slot in to_extension table
func WrapClient ¶
func WrapClient( cl **toclient.Session, clF func(t *testing.T, toClient *toclient.Session), ) func(t *testing.T)
WrapClient is a temp func that creates a func(t *testing.T) from a *toclient.Session and a func(t *testing.T, toClient *toclient.Session).
func WrapClientDat ¶
func WrapClientDat( cl **toclient.Session, dat *totest.TrafficControl, clF func(t *testing.T, toClient *toclient.Session, dat totest.TrafficControl), ) func(t *testing.T)
WrapClient is a temp func that creates a func(t *testing.T) from a *toclient.Session, totest.TrafficControl, and a func(t *testing.T, toClient *toclient.Session, dat totest.TrafficControl).
func WrapClientDatDB ¶
func WrapNewClientDat ¶
func WrapNewClientDat( r *TCData, dat *totest.TrafficControl, user *string, pass *string, clF func(t *testing.T, toClient *toclient.Session, dat totest.TrafficControl), ) func(t *testing.T)
WrapNewClientDat is like WrapClientDat but creates a new custom TO client instead of using the global variable.
Types ¶
type TCData ¶
type TCData struct { Config *config.Config TestData *totest.TrafficControl }
func (*TCData) OpenConnection ¶
OpenConnection ...
func (*TCData) QueueUpdatesForServer ¶
func (*TCData) SetupSession ¶
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 ( ASN TCObj = iota CacheGroups CacheGroupsDeliveryServices // CacheGroupParameters CDNs CDNFederations Coordinates DeliveryServices DeliveryServicesRegexes DeliveryServiceRequests DeliveryServiceRequestComments DeliveryServicesRequiredCapabilities Divisions FederationResolvers FederationUsers Jobs Origins Parameters PhysLocations Profiles ProfileParameters Regions Roles ServerCapabilities ServerChecks ServerServerCapabilities Servers Statuses ServiceCategories StaticDNSEntries SteeringTargets Tenants ServerCheckExtensions Topologies Types Users )