3fe2c8ccdd
This change introduces a testing framework for the dynamic_inventory.py script, which will be helpful in debugging any changes made to the script. Current testing is indirect, relying on the other, very high level gate tests, which may take longer to identify inventory generation issues. Currently, it does not do actual unit testing, instead opting to start by testing from 'outside', calling the script through a subprocess. In time, this should be replaced, but as a start it's easier to implement without making many changes. The 'tests/inventory' directory has the necessary pieces symlinked in; namely, env.d, openstack_environment.yml, and a sample openstack_user-config.yml (based on the AIO one already used in the gates). A new tox environment, 'inventory' was added rather than creating a new 'gate-check-inventory.sh' file. This should fit the general openstack-infra testing framework better. For the first test, I decided to add a loop that runs 100 times because of the nature of the script. Since the dynamic_inventory script does not assign IP addresses sequentially, the loop helps exercise a larger sample than just one run per test. On my local machine, this took approximately 2 seconds. Running it 1,000 times took about 30 seconds. Thus, the time spent right now is minimal in comparison to the rest of the gate jobs. As it stands, the test suite is by no means complete, but serves as a starting point. Change-Id: I7410360ecec919639a299f72f2f3cc818bce8e33
Symbolic link
1 line
56 B
YAML
Symbolic link
1 line
56 B
YAML
../../etc/openstack_deploy/openstack_user_config.yml.aio |