The Traffic Ops Client API tests are used to validate the clients responses against those from the Traffic Ops API.
In order to run the tests you will need the following:
Port access to both the Postgres port (usually 5432) that your Traffic Ops instance is using as well as the Traffic Ops configured port (usually 443 or 60443).
An instance of Postgres running with a to_test
database that has empty tables.
To get your to_test database setup do the following:
$ cd trafficcontrol/traffic_ops/app
$ db/admin --env=test reset
NOTE on passwords: Check that the passwords defined defined for your to_test
database match here: trafficcontrol/traffic_ops/app/conf/test/database.conf
and here: traffic-ops-test.conf
The Traffic Ops users will be created by the tool for accessing the API once the database is accessible.
For more info see: http://trafficcontrol.apache.org/docs/latest/development/traffic_ops.html?highlight=reset
A running Traffic Ops instance running with the secure
(https) and is pointing to the to_test
database by running in MOJO_MODE=test
which will point to your to_test
database. To get your to_test database setup do the following:
$ export MOJO_MODE=test
$ cd trafficcontrol/traffic_ops/app
$ bin/start.pl --secure
A running Traffic Ops Golang proxy pointing to the to_test database. $ cd trafficcontrol/traffic_ops/traffic_ops_golang
$ cp ../app/conf/cdn.conf $HOME/cdn.conf
change traffic_ops_golang->port
to 8443
$ go build && ./traffic_ops_golang -cfg $HOME/cdn.conf -dbcfg ../app/conf/test/database.conf
The integration tests are run using go test
, however, there are some flags that need to be provided in order for the tests to work.
The flags are:
Example command to run the tests: TO_URL=https://localhost:8443 go test -v -cfg=traffic-ops-test.conf -run TestCDNs
-v
flag is recommended to see progress.*