Beispiel #1
0
def get_openshift_cluster_info(request, load_config_file):
    """ Fixture to get openshift cluster info """
    openshift_tests_log_dir = request.config.getoption("--openshift-tests-log-dir")
    openshift_tests_log_level = request.config.getoption("--openshift-tests-log-level")
    log_to_stdout = request.config.getoption("--log-to-stdout")
    log_name = "ocp_tests_log"

    # Create log dir if logs dir does not exist.
    openshift_tests_log_dir = os.path.abspath(openshift_tests_log_dir)
    if not os.path.exists(openshift_tests_log_dir):
        os.makedirs(os.path.abspath(openshift_tests_log_dir))

    # Define filename with timestamp
    filename = os.path.join(
        openshift_tests_log_dir, ("ocp_tests_log_%s.log" % datetime.now().strftime("%Y_%m_%d_%H_%M_%S"))
    )

    g.log = g.create_log(name=log_name, filename=filename, level=openshift_tests_log_level)

    if "true" in log_to_stdout.lower():
        g.add_log(g.log, filename="STDOUT")

    default_ocp_tests_config_file = request.config.getoption("--openshift-default-tests-config")

    if default_ocp_tests_config_file is not None:
        config = load_config_file(default_ocp_tests_config_file)
        g.update_config(config)

    openshift_cluster_config = {}
    openshift_first_master = request.config.getoption("--openshift-first-master")
    openshift_cluster_config["first_master"] = openshift_first_master
    # TODO'S Get master, nodes, OcpAppMgmt instance here.

    g.update_config(openshift_cluster_config)
    g.log.info("openshift tests default configs:\n%s", g.config)
 def setUpClass(cls):
     """unittest standard setUpClass method
     Runs before all test_ methods in the class
     """
     print "Setting Up Class: %s" % cls.__name__
     config = g.load_configs(["../examples/systems.yml",
                              "../examples/glusto.yml"])
     g.update_config(config)
Beispiel #3
0
 def setUpClass(cls):
     """unittest standard setUpClass method
     Runs before all test_ methods in the class
     """
     print "Setting Up Class: %s" % cls.__name__
     config = g.load_configs(
         ["../examples/systems.yml", "../examples/glusto.yml"])
     g.update_config(config)
    def setUp(self):
        """unittest standard setUp method
        Runs before each test_ method
        """
        print "Setting Up: %s" % self.id()
        config = g.load_configs(["../examples/systems.yml",
                                 "../examples/glusto.yml"])
        g.update_config(config)

        self.masternode = g.config["nodes"][0]
        self.client = g.config["clients"][0]
Beispiel #5
0
    def setUp(self):
        """unittest standard setUp method
        Runs before each test_ method
        """
        print "Setting Up: %s" % self.id()
        config = g.load_configs(
            ["../examples/systems.yml", "../examples/glusto.yml"])
        g.update_config(config)

        self.masternode = g.config["nodes"][0]
        self.client = g.config["clients"][0]
Beispiel #6
0
    def setUpClass(cls):
        """unittest standard setUpClass method
        Runs before all test_ methods in the class
        """
        print "Setting Up Class: %s" % cls.__name__

        config = g.load_configs(
            ["examples/systems.yml", "examples/glusto.yml"])
        g.update_config(config)

        cls.masternode = g.config["nodes"][0]
        cls.client = g.config["clients"][0]
Beispiel #7
0
def handle_configs(config_list):
    """Load default and user-specified configuration files"""

    # load default config
    g.log.info("Loading default configuration files.")
    g.load_config_defaults()

    # load user specified configs (can also override defaults)
    if (config_list):
        g.log.info("Loading user specified configuration files.")
        config_files = config_list.split()
        config = g.load_configs(config_files)
        g.update_config(config)
Beispiel #8
0
def handle_configs(config_list):
    """Load default and user-specified configuration files"""

    # load default config
    g.log.info("Loading default configuration files.")
    g.load_config_defaults()

    # load user specified configs (can also override defaults)
    if (config_list):
        g.log.info("Loading user specified configuration files.")
        config_files = config_list.split()
        config = g.load_configs(config_files)
        g.update_config(config)
Beispiel #9
0
    def setUpClass(cls):
        """unittest standard setUpClass method
        Runs before all test_ methods in the class
        """
        print "Setting Up Class: %s" % cls.__name__
        config = g.load_configs(
            ["../examples/systems.yml", "../examples/glusto.yml"])
        g.update_config(config)

        cls.hosts = g.config['nodes']
        cls.primary_host = g.config['nodes'][0]
        cls.client = g.config["clients"][0]

        cls.test_string = 'Go for the Glusto!'
Beispiel #10
0
    def setUpClass(cls):
        """unittest standard setUpClass method
        Runs before all test_ methods in the class
        """
        print "Setting Up Class: %s" % cls.__name__
        config = g.load_configs(["../examples/systems.yml",
                                 "../examples/glusto.yml"])
        g.update_config(config)

        cls.hosts = g.config['nodes']
        cls.primary_host = g.config['nodes'][0]
        cls.client = g.config["clients"][0]

        cls.test_string = 'Go for the Glusto!'
Beispiel #11
0
    def setUpClass(cls):
        """unittest standard setUpClass method
        Runs before all test_ methods in the class
        """
        print "Setting Up Class: %s" % cls.__name__

        # Setting class attributes for use across all test methods
        cls.config_file = ('supporting_files/templates/'
                           'glusto_templates-vars.yml')
        config = g.load_config(cls.config_file)
        g.show_config(config)
        if config:
            g.update_config(config)

        cls.template_vars = g.config['templates']
        cls.template_file = ('templates/' 'glusto_templates-template.jinja')
        cls.search_path = 'supporting_files'
        cls.output_file = '/tmp/glusto_templates-output.yml'
    def setUpClass(cls):
        """unittest standard setUpClass method
        Runs before all test_ methods in the class
        """
        print "Setting Up Class: %s" % cls.__name__

        # Setting class attributes for use across all test methods
        cls.config_file = ('supporting_files/templates/'
                           'glusto_templates-vars.yml')
        config = g.load_config(cls.config_file)
        g.show_config(config)
        if config:
            g.update_config(config)

        cls.template_vars = g.config['templates']
        cls.template_file = ('templates/'
                             'glusto_templates-template.jinja')
        cls.search_path = 'supporting_files'
        cls.output_file = '/tmp/glusto_templates-output.yml'
from glusto.core import Glusto as g

print "Python startup starting"
config = g.load_config('examples/systems.yml')
g.update_config(config)
rcode, uname_info, rerr = g.run(config['nodes'][0], 'uname -a')
print "Python startup complete"