ansible/test
Adrian Likins 95abc1d82e Fix fact failures cause by ordering of collectors (#30777)
* Fix fact failures cause by ordering of collectors

Some fact collectors need info collected by other facts.
(for ex, service_mgr needs to know 'ansible_system').
This info is passed to the Collector.collect method via
the 'collected_facts' info.

But, the order the fact collectors were running in is
not a set order, so collectors like service_mgr could
run before the PlatformFactCollect ('ansible_system', etc),
so the 'ansible_system' fact would not exist yet. 

Depending on the collector and the deps, this can result
in incorrect behavior and wrong or missing facts.

To make the ordering of the collectors more consistent
and predictable, the code that builds that list is now
driven by the order of collectors in default_collectors.py,
and the rest of the code tries to preserve it.

* Flip the loops when building collector names

iterate over the ordered default_collectors list
selecting them for the final list in order instead
of driving it from the unordered collector_names set.

This lets the list returned by select_collector_classes
to stay in the same order as default_collectors.collectors

For collectors that have implicit deps on other fact collectors,
the default collectors can be ordered to include those early.

* default_collectors.py now uses a handful of sub lists of
collectors that can be ordered in default_collectors.collectors.

fixes #30753
fixes #30623
2017-09-28 10:36:22 -04:00
..
compile Docs how to test (2nd) (#24094) 2017-04-28 09:08:26 +01:00
integration Fix fact failures cause by ordering of collectors (#30777) 2017-09-28 10:36:22 -04:00
legacy Add a code-smell test for smart quotes and remove smart quotes from all files 2017-09-18 16:49:16 -07:00
results Collect data from integration test runs. (#28650) 2017-08-25 18:14:47 -04:00
runner Add region to ansible-test AWS cloud config. (#30733) 2017-09-22 00:19:21 -07:00
sanity virt: PEP8 compliancy and doc fixes (#30917) 2017-09-27 22:37:54 -04:00
units Fix fact failures cause by ordering of collectors (#30777) 2017-09-28 10:36:22 -04:00
utils Run all Windows tests if change detection disabled (#30320) 2017-09-13 22:21:19 -07:00