Skip to content

Running T0 Unit Tests

Germán Felipe Giraldo Villa edited this page Apr 30, 2021 · 1 revision

Running a Unit test on Tier0

To run Tier0 Unit tests, you need to have access to our secrets files, which means the tests must be run from our VMs. All you need to do is set the proper environment by sourcing the following scripts:

source /data/tier0/srv/wmagent/current/apps/t0/etc/profile.d/init.sh

source /data/tier0/admin/env_unit.sh [WMCORE_PATH]

By default, the scripts will set PYTHONPATH to point to the WMCore libraries currently deployed in the node's agent. If you want to test WMCore changes, you need to either patch the current deployment (you can use 00_patches.sh), or provide the path to the WMCore repository whose code you want to use. These scripts will alsos set the following env variables:

  • WMAGENT_SECRETS_LOCATION
  • X509_USER_CERT
  • X509_USER_KEY
  • PYTHONPATH
  • LD_LIBRARY_PATH

Keep them in mind in case you need to modify their values.

Before running the tests, you need to wipe out the database that you are going to use for it (you can use 00_wipe_t0ast). Then you can just simply run the unit tests from the copy of the tier0 repo you're working on. For this you can simply use python, or testing tools like nosetests. For example:

$ python Tier0Feeder_t.py

$ nosetests Tier0Feeder_t.py

$ nosetests Tier0Feeder_t.py:Tier0FeederTest.test05

Useful links

Clone this wiki locally