Blame SOURCES/0002-Remove-ipaclustercheck.patch

58cdda
From ea9e00e47307b4ab81cc31c37796dd7b6a4c8785 Mon Sep 17 00:00:00 2001
58cdda
From: Rob Crittenden <rcritten@redhat.com>
58cdda
Date: Thu, 29 Oct 2020 11:49:22 -0400
58cdda
Subject: [PATCH] Remove ipaclustercheck
58cdda
58cdda
Not shipping it from upstream into Fedora just yet
58cdda
---
58cdda
 setup.py                              |  12 +-
58cdda
 src/ipaclustercheck/__init__.py       |   5 -
58cdda
 src/ipaclustercheck/core/__init__.py  |   0
58cdda
 src/ipaclustercheck/core/main.py      |  30 -----
58cdda
 src/ipaclustercheck/core/output.py    |  67 ------------
58cdda
 src/ipaclustercheck/ipa/__init__.py   |   0
58cdda
 src/ipaclustercheck/ipa/crlmanager.py |  36 ------
58cdda
 src/ipaclustercheck/ipa/plugin.py     | 114 -------------------
58cdda
 src/ipaclustercheck/ipa/ruv.py        | 151 --------------------------
58cdda
 tests/test_cluster_ruv.py             | 106 ------------------
58cdda
 10 files changed, 1 insertion(+), 520 deletions(-)
58cdda
 delete mode 100644 src/ipaclustercheck/__init__.py
58cdda
 delete mode 100644 src/ipaclustercheck/core/__init__.py
58cdda
 delete mode 100644 src/ipaclustercheck/core/main.py
58cdda
 delete mode 100644 src/ipaclustercheck/core/output.py
58cdda
 delete mode 100644 src/ipaclustercheck/ipa/__init__.py
58cdda
 delete mode 100644 src/ipaclustercheck/ipa/crlmanager.py
58cdda
 delete mode 100644 src/ipaclustercheck/ipa/plugin.py
58cdda
 delete mode 100644 src/ipaclustercheck/ipa/ruv.py
58cdda
 delete mode 100644 tests/test_cluster_ruv.py
58cdda
58cdda
diff --git a/setup.py b/setup.py
58cdda
index 2b519fc..c25b2d7 100644
58cdda
--- a/setup.py
58cdda
+++ b/setup.py
58cdda
@@ -4,7 +4,7 @@ from setuptools import find_packages, setup
58cdda
 setup(
58cdda
     name='ipahealthcheck',
58cdda
     version='0.7',
58cdda
-    namespace_packages=['ipahealthcheck', 'ipaclustercheck'],
58cdda
+    namespace_packages=['ipahealthcheck'],
58cdda
     package_dir={'': 'src'},
58cdda
     # packages=find_packages(where='src'),
58cdda
     packages=[
58cdda
@@ -14,14 +14,11 @@ setup(
58cdda
         'ipahealthcheck.ipa',
58cdda
         'ipahealthcheck.meta',
58cdda
         'ipahealthcheck.system',
58cdda
-        'ipaclustercheck.core',
58cdda
-        'ipaclustercheck.ipa',
58cdda
     ],
58cdda
     entry_points={
58cdda
         # creates bin/ipahealthcheck
58cdda
         'console_scripts': [
58cdda
             'ipa-healthcheck = ipahealthcheck.core.main:main',
58cdda
-            'ipa-clustercheck = ipaclustercheck.core.main:main',
58cdda
         ],
58cdda
         # subsystem registries
58cdda
         'ipahealthcheck.registry': [
58cdda
@@ -69,13 +66,6 @@ setup(
58cdda
         'ipahealthcheck.system': [
58cdda
             'filesystemspace = ipahealthcheck.system.filesystemspace',
58cdda
         ],
58cdda
-        'ipaclustercheck.registry': [
58cdda
-            'ipaclustercheck.ipa = ipaclustercheck.ipa.plugin:registry',
58cdda
-        ],
58cdda
-        'ipaclustercheck.ipa': [
58cdda
-            'crl = ipaclustercheck.ipa.crlmanager',
58cdda
-            'ruv = ipaclustercheck.ipa.ruv',
58cdda
-        ],
58cdda
     },
58cdda
     classifiers=[
58cdda
         'Programming Language :: Python :: 3.6',
58cdda
diff --git a/src/ipaclustercheck/__init__.py b/src/ipaclustercheck/__init__.py
58cdda
deleted file mode 100644
58cdda
index 6c91ef7..0000000
58cdda
--- a/src/ipaclustercheck/__init__.py
58cdda
+++ /dev/null
58cdda
@@ -1,5 +0,0 @@
58cdda
-#
58cdda
-# Copyright (C) 2019 FreeIPA Contributors see COPYING for license
58cdda
-#
58cdda
-
58cdda
-__import__('pkg_resources').declare_namespace(__name__)
58cdda
diff --git a/src/ipaclustercheck/core/__init__.py b/src/ipaclustercheck/core/__init__.py
58cdda
deleted file mode 100644
58cdda
index e69de29..0000000
58cdda
diff --git a/src/ipaclustercheck/core/main.py b/src/ipaclustercheck/core/main.py
58cdda
deleted file mode 100644
58cdda
index 45fda9f..0000000
58cdda
--- a/src/ipaclustercheck/core/main.py
58cdda
+++ /dev/null
58cdda
@@ -1,30 +0,0 @@
58cdda
-#
58cdda
-# Copyright (C) 2020 FreeIPA Contributors see COPYING for license
58cdda
-#
58cdda
-
58cdda
-import sys
58cdda
-
58cdda
-from ipaclustercheck.core.output import output_registry
58cdda
-from ipahealthcheck.core.core import RunChecks
58cdda
-
58cdda
-
58cdda
-class ClusterChecks(RunChecks):
58cdda
-
58cdda
-    def add_options(self):
58cdda
-        parser = self.parser
58cdda
-        parser.add_argument('--directory', dest='dir',
58cdda
-                            help='Directory holding healthcheck logs')
58cdda
-
58cdda
-    def validate_options(self):
58cdda
-        super(ClusterChecks, self).validate_options()
58cdda
-
58cdda
-        if self.options.dir is None:
58cdda
-            print("--directory containing logs to check is required")
58cdda
-            return 1
58cdda
-
58cdda
-
58cdda
-def main():
58cdda
-    clusterchecks = ClusterChecks(['ipaclustercheck.registry'],
58cdda
-                                   '/etc/ipa/clustercheck.conf',
58cdda
-                                   output_registry, 'ansible')
58cdda
-    sys.exit(clusterchecks.run_healthcheck())
58cdda
diff --git a/src/ipaclustercheck/core/output.py b/src/ipaclustercheck/core/output.py
58cdda
deleted file mode 100644
58cdda
index 2f02b52..0000000
58cdda
--- a/src/ipaclustercheck/core/output.py
58cdda
+++ /dev/null
58cdda
@@ -1,67 +0,0 @@
58cdda
-#
58cdda
-# Copyright (C) 2019 FreeIPA Contributors see COPYING for license
58cdda
-#
58cdda
-
58cdda
-import json
58cdda
-import sys
58cdda
-from ipahealthcheck.core.output import OutputRegistry, Output
58cdda
-
58cdda
-
58cdda
-output_registry = OutputRegistry()
58cdda
-
58cdda
-class ClusterOutput(Output):
58cdda
-    """Base class for writing/display output of cluster results
58cdda
-
58cdda
-       severity doesn't apply in this case so exclude those.
58cdda
-    """
58cdda
-    def __init__(self, options):
58cdda
-        self.filename = options.outfile
58cdda
-
58cdda
-    def strip_output(self, results):
58cdda
-        """Nothing to strip out"""
58cdda
-        return [result for result in results.output()]
58cdda
-
58cdda
-
58cdda
-@output_registry
58cdda
-class Ansible(ClusterOutput):
58cdda
-    """Output information JSON format for consumption by Ansible
58cdda
-
58cdda
-       Required keywords in a Result:
58cdda
-       name - unique identifier for the return value
58cdda
-
58cdda
-       One of these is required:
58cdda
-       value - the return value. Type? I dunno yet
58cdda
-       error - if an error was returned
58cdda
-    """
58cdda
-
58cdda
-    options = (
58cdda
-        ('--indent', dict(dest='indent', type=int, default=2,
58cdda
-         help='Indention level of JSON output')),
58cdda
-    )
58cdda
-
58cdda
-    def __init__(self, options):
58cdda
-        super(Ansible, self).__init__(options)
58cdda
-        self.indent = options.indent
58cdda
-
58cdda
-    def generate(self, data):
58cdda
-        output = []
58cdda
-        for line in data:
58cdda
-            kw = line.get('kw')
58cdda
-            result = line.get('result')
58cdda
-            name = kw.get('name')
58cdda
-            value = kw.get('value')
58cdda
-            error = kw.get('error')
58cdda
-
58cdda
-            if value and error:
58cdda
-                value = '%s: %s' % (error, value)
58cdda
-            elif error:
58cdda
-                value = error
58cdda
-
58cdda
-            rval = {'%s' % name: value}
58cdda
-            output.append(rval)
58cdda
-            
58cdda
-        output = json.dumps(output, indent=self.indent)
58cdda
-        if self.filename is None:
58cdda
-            output += '\n'
58cdda
-
58cdda
-        return output
58cdda
diff --git a/src/ipaclustercheck/ipa/__init__.py b/src/ipaclustercheck/ipa/__init__.py
58cdda
deleted file mode 100644
58cdda
index e69de29..0000000
58cdda
diff --git a/src/ipaclustercheck/ipa/crlmanager.py b/src/ipaclustercheck/ipa/crlmanager.py
58cdda
deleted file mode 100644
58cdda
index 6806d74..0000000
58cdda
--- a/src/ipaclustercheck/ipa/crlmanager.py
58cdda
+++ /dev/null
58cdda
@@ -1,36 +0,0 @@
58cdda
-#
58cdda
-# Copyright (C) 2019 FreeIPA Contributors see COPYING for license
58cdda
-#
58cdda
-
58cdda
-from ipaclustercheck.ipa.plugin import ClusterPlugin, registry, find_checks
58cdda
-from ipahealthcheck.core.plugin import Result, duration
58cdda
-from ipahealthcheck.core import constants
58cdda
-
58cdda
-
58cdda
-@registry
58cdda
-class ClusterCRLManagerCheck(ClusterPlugin):
58cdda
-
58cdda
-    @duration
58cdda
-    def check(self):
58cdda
-        data = self.registry.json
58cdda
-        crlmanagers = []
58cdda
-
58cdda
-        for fqdn in data.keys():
58cdda
-             output = find_checks(data[fqdn], 'ipahealthcheck.ipa.roles',
58cdda
-                                 'IPACRLManagerCheck')
58cdda
-             enabled = output[0].get('kw').get('crlgen_enabled')
58cdda
-             if enabled:
58cdda
-                 crlmanagers.append(fqdn)
58cdda
-        if len(crlmanagers) == 0:
58cdda
-            yield Result(self, constants.ERROR,
58cdda
-                         name='crlmanager',
58cdda
-                         error='No CRL Manager defined')
58cdda
-        elif len(crlmanagers) == 1:
58cdda
-            yield Result(self, constants.SUCCESS,
58cdda
-                         name='crlmanager',
58cdda
-                         value=crlmanagers[0])
58cdda
-        else:
58cdda
-            yield Result(self, constants.ERROR,
58cdda
-                         name='crlmanager',
58cdda
-                         value=','.join(crlmanagers),
58cdda
-                         error='Multiple CRL Managers defined')
58cdda
diff --git a/src/ipaclustercheck/ipa/plugin.py b/src/ipaclustercheck/ipa/plugin.py
58cdda
deleted file mode 100644
58cdda
index d9b6063..0000000
58cdda
--- a/src/ipaclustercheck/ipa/plugin.py
58cdda
+++ /dev/null
58cdda
@@ -1,114 +0,0 @@
58cdda
-#
58cdda
-# Copyright (C) 2020 FreeIPA Contributors see COPYING for license
58cdda
-#
58cdda
-
58cdda
-from copy import deepcopy
58cdda
-import json
58cdda
-import logging
58cdda
-from os import listdir
58cdda
-from os.path import isfile, join
58cdda
-
58cdda
-from ipahealthcheck.core.plugin import Plugin, Registry
58cdda
-from ipalib import api
58cdda
-
58cdda
-
58cdda
-logger = logging.getLogger()
58cdda
-
58cdda
-def find_checks(data, source, check):
58cdda
-    """Look through the dict for a matching source and check.
58cdda
-
58cdda
-       data: dict of source and check output
58cdda
-       source: name of source to find
58cdda
-       check: name of check to find
58cdda
-
58cdda
-       Returns list of contents of source + check or empty list
58cdda
-    """
58cdda
-    rval = []
58cdda
-    for d in data:
58cdda
-        if d.get('source') == source and d.get('check') == check:
58cdda
-            rval.append(d)
58cdda
-
58cdda
-    return rval
58cdda
-
58cdda
-
58cdda
-def get_masters(data):
58cdda
-    """
58cdda
-    Return the list of known masters
58cdda
-
58cdda
-    This is determined from the list of loaded healthcheck logs. It
58cdda
-    is possible that mixed versions are used so some may not be
58cdda
-    reporting the full list of masters, so check them all, and raise
58cdda
-    an exception if the list cannot be determined.
58cdda
-    """
58cdda
-    test_masters = list(data)
58cdda
-    masters = None
58cdda
-    for master in test_masters:
58cdda
-        output = find_checks(data[master], 'ipahealthcheck.ipa.meta',
58cdda
-                             'IPAMetaCheck')
58cdda
-        if len(output) == 0:
58cdda
-            raise ValueError('Unable to determine full list of masters. '
58cdda
-                             'ipahealthcheck.ipa.meta:IPAMetaCheck not '
58cdda
-                             'found.')
58cdda
-
58cdda
-        masters = output[0].get('kw').get('masters')
58cdda
-        if masters:
58cdda
-            return masters          
58cdda
-
58cdda
-    raise ValueError('Unable to determine full list of masters. '
58cdda
-                     'None of ipahealthcheck.ipa.meta:IPAMetaCheck '
58cdda
-                     'contain masters.')
58cdda
-
58cdda
-
58cdda
-class ClusterPlugin(Plugin):
58cdda
-    def __init__(self, registry):
58cdda
-        super(ClusterPlugin, self).__init__(registry)
58cdda
-
58cdda
-
58cdda
-class ClusterRegistry(Registry):
58cdda
-    def initialize(self, framework, config, options):
58cdda
-        super(ClusterRegistry, self).initialize(framework, config, options)
58cdda
-
58cdda
-        self.json = {}
58cdda
-
58cdda
-        self.load_files(options.dir)
58cdda
-
58cdda
-        if not api.isdone('finalize'):
58cdda
-            if not api.isdone('bootstrap'):
58cdda
-                api.bootstrap(in_server=True,
58cdda
-                              context='ipahealthcheck',
58cdda
-                              log=None)
58cdda
-            if not api.isdone('finalize'):
58cdda
-                api.finalize()
58cdda
-
58cdda
-    def load_files(self, dir):
58cdda
-        if self.json:
58cdda
-            return
58cdda
-
58cdda
-        files = [f for f in listdir(dir) if isfile(join(dir, f))]
58cdda
-        for file in files:
58cdda
-            fname = join(dir, file)
58cdda
-            logger.debug("Reading %s", fname)
58cdda
-            try:
58cdda
-                with open(fname, 'r') as fd:
58cdda
-                    data = fd.read()
58cdda
-            except Exception as e:
58cdda
-                logger.error("Unable to read %s: %s", fname, e)
58cdda
-                continue
58cdda
-        
58cdda
-            try:
58cdda
-                data = json.loads(data)
58cdda
-            except Exception as e:
58cdda
-                logger.error("Unable to parse JSON in %s: %s", fname, e)
58cdda
-                continue
58cdda
-
58cdda
-            meta = find_checks(data, 'ipahealthcheck.meta.core',
58cdda
-                                   'MetaCheck')
58cdda
-            if meta:
58cdda
-                fqdn = meta[0].get('kw').get('fqdn')
58cdda
-                self.json[fqdn] = deepcopy(data)
58cdda
-            else:
58cdda
-                logger.error("No fqdn defined in JSON in %s", fname)
58cdda
-                continue
58cdda
-        
58cdda
-        
58cdda
-registry = ClusterRegistry()
58cdda
diff --git a/src/ipaclustercheck/ipa/ruv.py b/src/ipaclustercheck/ipa/ruv.py
58cdda
deleted file mode 100644
58cdda
index 0e51da9..0000000
58cdda
--- a/src/ipaclustercheck/ipa/ruv.py
58cdda
+++ /dev/null
58cdda
@@ -1,151 +0,0 @@
58cdda
-#
58cdda
-# Copyright (C) 2019 FreeIPA Contributors see COPYING for license
58cdda
-#
58cdda
-
58cdda
-import logging
58cdda
-
58cdda
-from ipaclustercheck.ipa.plugin import (
58cdda
-    ClusterPlugin,
58cdda
-    registry,
58cdda
-    find_checks,
58cdda
-    get_masters
58cdda
-)
58cdda
-from ipahealthcheck.core.plugin import Result, duration
58cdda
-from ipahealthcheck.core import constants
58cdda
-from ipalib import api
58cdda
-from ipapython.dn import DN
58cdda
-
58cdda
-
58cdda
-logger = logging.getLogger()
58cdda
-
58cdda
-
58cdda
-@registry
58cdda
-class ClusterRUVCheck(ClusterPlugin):
58cdda
-
58cdda
-    # TODO: confirm that all masters are represented, otherwise the
58cdda
-    #       trustworthiness of dangling RUV is mixed.
58cdda
-    #
58cdda
-    #       gah, need to provide full list of all masters in a check.
58cdda
-
58cdda
-    @duration
58cdda
-    def check(self):
58cdda
-        data = self.registry.json
58cdda
-
58cdda
-        # Start with the list of masters from the file(s) collected
58cdda
-        # and find a MetaCheck with a full list of masters. For
58cdda
-        # backwards compatibility.
58cdda
-        try:
58cdda
-            masters = get_masters(data)
58cdda
-        except ValueError as e:
58cdda
-            yield Result(self, constants.ERROR,
58cdda
-                         name='dangling_ruv',
58cdda
-                         error=str(e))
58cdda
-            return
58cdda
-
58cdda
-        if len(data.keys()) < len(masters):
58cdda
-            yield Result(self, constants.ERROR,
58cdda
-                         name='dangling_ruv',
58cdda
-                         error='Unable to determine list of RUVs, missing '
58cdda
-                               'some masters: %s' %
58cdda
-                               ''.join(set(masters) - set(data.keys())))
58cdda
-            return
58cdda
-
58cdda
-        # collect the full set of known RUVs for each master
58cdda
-        info = {}
58cdda
-        for master in masters:
58cdda
-            info[master] = {
58cdda
-                'ca': False,           # does the host have ca configured?
58cdda
-                'ruvs': set(),         # ruvs on the host
58cdda
-                'csruvs': set(),       # csruvs on the host
58cdda
-                'clean_ruv': set(),    # ruvs to be cleaned from the host
58cdda
-                'clean_csruv': set()   # csruvs to be cleaned from the host
58cdda
-                }
58cdda
-
58cdda
-        for fqdn in data.keys():
58cdda
-            outputs = find_checks(data[fqdn], 'ipahealthcheck.ds.ruv',
58cdda
-                                  'KnownRUVCheck')
58cdda
-            for output in outputs:
58cdda
-                if not 'suffix' in output.get('kw'):
58cdda
-                    continue
58cdda
-                basedn = DN(output.get('kw').get('suffix'))
58cdda
-
58cdda
-                ruvset = set()
58cdda
-                ruvtmp = output.get('kw').get('ruvs')
58cdda
-                for ruv in ruvtmp:
58cdda
-                    ruvset.add(tuple(ruv))
58cdda
-
58cdda
-                if basedn == DN('o=ipaca'):
58cdda
-                    info[fqdn]['ca'] = True
58cdda
-                    info[fqdn]['csruvs'] = ruvset
58cdda
-                elif basedn == api.env.basedn:
58cdda
-                    info[fqdn]['ruvs'] = ruvset
58cdda
-                else:
58cdda
-                    yield Result(self, constants.WARNING,
58cdda
-                                 name='dangling_ruv',
58cdda
-                                 error='Unknown suffix found %s expected %s'
58cdda
-                                       % (basedn, api.env.basedn))
58cdda
-
58cdda
-        # Collect the nsDS5ReplicaID for each master
58cdda
-        ruvs = set()
58cdda
-        csruvs = set()
58cdda
-        for fqdn in data.keys():
58cdda
-            outputs = find_checks(data[fqdn], 'ipahealthcheck.ds.ruv',
58cdda
-                                  'RUVCheck')
58cdda
-            for output in outputs:
58cdda
-                if not 'key' in output.get('kw'):
58cdda
-                    continue
58cdda
-                basedn = DN(output.get('kw').get('key'))
58cdda
-                ruv = (fqdn, (output.get('kw').get('ruv')))
58cdda
-                if basedn == DN('o=ipaca'):
58cdda
-                    csruvs.add(ruv)
58cdda
-                elif basedn == api.env.basedn:
58cdda
-                    ruvs.add(ruv)
58cdda
-                else:
58cdda
-                    yield Result(self, constants.WARNING,
58cdda
-                                 name='dangling_ruv',
58cdda
-                                 error='Unknown suffix found %s expected %s'
58cdda
-                                       % (basedn, api.env.basedn))
58cdda
-
58cdda
-        dangles = False
58cdda
-        # get the dangling RUVs
58cdda
-        for master_info in info.values():
58cdda
-            for ruv in master_info['ruvs']:
58cdda
-                if ruv not in ruvs:
58cdda
-                    master_info['clean_ruv'].add(ruv)
58cdda
-                    dangles = True
58cdda
-
58cdda
-            # if ca is not configured, there will be no csruvs in master_info
58cdda
-            for csruv in master_info['csruvs']:
58cdda
-                if csruv not in csruvs:
58cdda
-                    master_info['clean_csruv'].add(csruv)
58cdda
-                    dangles = True
58cdda
-
58cdda
-        clean_csruvs = set()
58cdda
-        clean_ruvs = set()
58cdda
-        if dangles:
58cdda
-            for master_cn, master_info in info.items():
58cdda
-                for ruv in master_info['clean_ruv']:
58cdda
-                    logger.debug('Dangling RUV id: {id}, hostname: {host}'
58cdda
-                                 .format(id=ruv[1], host=ruv[0]))
58cdda
-                    clean_ruvs.add(ruv[1])
58cdda
-                for csruv in master_info['clean_csruv']:
58cdda
-                    logger.debug('Dangling CS RUV id: {id}, hostname: {host}'
58cdda
-                                 .format(id=csruv[1], host=csruv[0]))
58cdda
-                    clean_csruvs.add(csruv[1])
58cdda
-
58cdda
-        if clean_ruvs:
58cdda
-            yield Result(self, constants.ERROR,
58cdda
-                         name='dangling_ruv',
58cdda
-                         value=', '.join(clean_ruvs))
58cdda
-        else:
58cdda
-            yield Result(self, constants.SUCCESS,
58cdda
-                         name='dangling_ruv',
58cdda
-                         value='No dangling RUVs found')
58cdda
-        if clean_csruvs:
58cdda
-            yield Result(self, constants.ERROR,
58cdda
-                         name='dangling_csruv',
58cdda
-                         value=', '.join(clean_csruvs))
58cdda
-        else:
58cdda
-            yield Result(self, constants.SUCCESS,
58cdda
-                         name='dangling_csruv',
58cdda
-                         value='No dangling CS RUVs found')
58cdda
diff --git a/tests/test_cluster_ruv.py b/tests/test_cluster_ruv.py
58cdda
deleted file mode 100644
58cdda
index 7583c84..0000000
58cdda
--- a/tests/test_cluster_ruv.py
58cdda
+++ /dev/null
58cdda
@@ -1,106 +0,0 @@
58cdda
-#
58cdda
-# Copyright (C) 2019 FreeIPA Contributors see COPYING for license
58cdda
-#
58cdda
-
58cdda
-from base import BaseTest
58cdda
-from util import capture_results
58cdda
-
58cdda
-from ipahealthcheck.core import config
58cdda
-from ipaclustercheck.ipa.plugin import ClusterRegistry
58cdda
-from ipaclustercheck.ipa.ruv import ClusterRUVCheck
58cdda
-
58cdda
-import clusterdata
58cdda
-
58cdda
-
58cdda
-class RUVRegistry(ClusterRegistry):
58cdda
-    def load_files(self, dir):
58cdda
-        self.json = dir
58cdda
-
58cdda
-
58cdda
-class Options:
58cdda
-    def __init__(self, data):
58cdda
-        self.data = data
58cdda
-
58cdda
-    @property
58cdda
-    def dir(self):
58cdda
-        return self.data
58cdda
-
58cdda
-
58cdda
-registry = RUVRegistry()
58cdda
-
58cdda
-
58cdda
-class TestClusterRUV(BaseTest):
58cdda
-
58cdda
-    def test_no_ruvs(self):
58cdda
-        """Single master test that has never created a replica
58cdda
-
58cdda
-           This type of master will have no RUVs created at all.
58cdda
-        """
58cdda
-        framework = object()
58cdda
-        registry.initialize(framework, config.Config,
58cdda
-                            Options(clusterdata.ONE_MASTER))
58cdda
-        f = ClusterRUVCheck(registry)
58cdda
-
58cdda
-        self.results = capture_results(f)
58cdda
-
58cdda
-        assert len(self.results) == 2
58cdda
-        result = self.results.results[0]
58cdda
-        assert result.kw.get('name') == 'dangling_ruv'
58cdda
-        assert result.kw.get('value') == 'No dangling RUVs found'
58cdda
-        result = self.results.results[1]
58cdda
-        assert result.kw.get('name') == 'dangling_csruv'
58cdda
-        assert result.kw.get('value') == 'No dangling CS RUVs found'
58cdda
-
58cdda
-    def test_six_ruvs_ok(self):
58cdda
-        """Three master test with each having a CA, no dangling
58cdda
-        """
58cdda
-        framework = object()
58cdda
-        registry.initialize(framework, config.Config,
58cdda
-                            Options(clusterdata.THREE_MASTERS_OK))
58cdda
-        f = ClusterRUVCheck(registry)
58cdda
-
58cdda
-        self.results = capture_results(f)
58cdda
-
58cdda
-        assert len(self.results) == 2
58cdda
-        result = self.results.results[0]
58cdda
-        assert result.kw.get('name') == 'dangling_ruv'
58cdda
-        assert result.kw.get('value') == 'No dangling RUVs found'
58cdda
-        result = self.results.results[1]
58cdda
-        assert result.kw.get('name') == 'dangling_csruv'
58cdda
-        assert result.kw.get('value') == 'No dangling CS RUVs found'
58cdda
-
58cdda
-    def test_six_ruvs_ipa_bad(self):
58cdda
-        """Three master test with each having a CA, dangling IPA RUV
58cdda
-        """
58cdda
-        framework = object()
58cdda
-        registry.initialize(framework, config.Config,
58cdda
-                            Options(clusterdata.THREE_MASTERS_BAD_IPA_RUV))
58cdda
-        f = ClusterRUVCheck(registry)
58cdda
-
58cdda
-        self.results = capture_results(f)
58cdda
-
58cdda
-        assert len(self.results) == 2
58cdda
-        result = self.results.results[0]
58cdda
-        assert result.kw.get('name') == 'dangling_ruv'
58cdda
-        assert result.kw.get('value') == '9'
58cdda
-        result = self.results.results[1]
58cdda
-        assert result.kw.get('name') == 'dangling_csruv'
58cdda
-        assert result.kw.get('value') == 'No dangling CS RUVs found'
58cdda
-
58cdda
-    def test_six_ruvs_cs_bad(self):
58cdda
-        """Three master test with each having a CA, dangling CA RUV
58cdda
-        """
58cdda
-        framework = object()
58cdda
-        registry.initialize(framework, config.Config,
58cdda
-                            Options(clusterdata.THREE_MASTERS_BAD_CS_RUV))
58cdda
-        f = ClusterRUVCheck(registry)
58cdda
-
58cdda
-        self.results = capture_results(f)
58cdda
-
58cdda
-        assert len(self.results) == 2
58cdda
-        result = self.results.results[0]
58cdda
-        assert result.kw.get('name') == 'dangling_ruv'
58cdda
-        assert result.kw.get('value') == 'No dangling RUVs found'
58cdda
-        result = self.results.results[1]
58cdda
-        assert result.kw.get('name') == 'dangling_csruv'
58cdda
-        assert result.kw.get('value') == '9'
58cdda
-- 
58cdda
2.25.4
58cdda