openshift_master_facts_conftest.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import os
  2. import sys
  3. import pytest
  4. sys.path.insert(1, os.path.join(os.path.dirname(__file__), os.pardir, "lookup_plugins"))
  5. from openshift_master_facts_default_predicates import LookupModule as PredicatesLookupModule # noqa: E402
  6. from openshift_master_facts_default_priorities import LookupModule as PrioritiesLookupModule # noqa: E402
  7. @pytest.fixture()
  8. def predicates_lookup():
  9. return PredicatesLookupModule()
  10. @pytest.fixture()
  11. def priorities_lookup():
  12. return PrioritiesLookupModule()
  13. @pytest.fixture()
  14. def facts():
  15. return {
  16. 'openshift': {
  17. 'common': {}
  18. }
  19. }
  20. @pytest.fixture(params=[True, False])
  21. def regions_enabled(request):
  22. return request.param
  23. @pytest.fixture(params=[True, False])
  24. def zones_enabled(request):
  25. return request.param
  26. def v_prefix(release):
  27. """Prefix a release number with 'v'."""
  28. return "v" + release
  29. def minor(release):
  30. """Add a suffix to release, making 'X.Y' become 'X.Y.Z'."""
  31. return release + ".1"
  32. @pytest.fixture(params=[str, v_prefix, minor])
  33. def release_mod(request):
  34. """Modifies a release string to alternative valid values."""
  35. return request.param