github.com/openshift/installer@v1.4.17/scripts/openstack/manifest-tests/lb-managed/test_cluster-infra.py (about)

     1  #!/usr/bin/env python
     2  # -*- coding: utf-8 -*-
     3  
     4  import unittest
     5  import xmlrunner
     6  
     7  import os
     8  import sys
     9  import glob
    10  import yaml
    11  
    12  ASSETS_DIR = ""
    13  
    14  class ManagedLoadBalancer(unittest.TestCase):
    15      def setUp(self):
    16          """Parse the Cluster Infrastructure object into a Python data structure."""
    17          self.machines = []
    18          cluster_infra = f'{ASSETS_DIR}/manifests/cluster-infrastructure-02-config.yml'
    19          with open(cluster_infra) as f:
    20              self.cluster_infra = yaml.load(f, Loader=yaml.FullLoader)
    21  
    22      def test_cluster_infra_object(self):
    23          """Assert that the Cluster infrastructure object contains the LoadBalancer configuration."""
    24          self.assertIn("loadBalancer", self.cluster_infra["status"]["platformStatus"]["openstack"])
    25  
    26          loadBalancer = self.cluster_infra["status"]["platformStatus"]["openstack"]["loadBalancer"]
    27  
    28          self.assertIn("type", loadBalancer)
    29          self.assertEqual("OpenShiftManagedDefault", loadBalancer["type"])
    30  
    31  
    32  if __name__ == '__main__':
    33      ASSETS_DIR = sys.argv.pop()
    34      with open(os.environ.get('JUNIT_FILE', '/dev/null'), 'wb') as output:
    35          unittest.main(testRunner=xmlrunner.XMLTestRunner(output=output), failfast=False, buffer=False, catchbreak=False, verbosity=2)