def test_healthcheck_non_replicated_suffixes(topology_m2): """Check if backend lint function unexpectedly throws exception :id: f922edf8-c527-4802-9f42-0b75bf97098a :setup: 2 MMR topology :steps: 1. Create a new suffix: cn=changelog 2. Call healthcheck (there should not be any exceptions raised) :expectedresults: 1. Success 2. Success """ inst = topology_m2.ms['master1'] # Create second suffix backends = Backends(inst) backends.create(properties={'nsslapd-suffix': "cn=changelog", 'name': 'changelog'}) # Call healthcheck args = FakeArgs() args.instance = inst.serverid args.verbose = inst.verbose args.list_errors = False args.list_checks = False args.check = ['backends'] args.dry_run = False args.json = False health_check_run(inst, topology_m2.logcap.log, args)
def run_healthcheck_and_flush_log(topology, instance, searched_code, json, searched_code2=None): args = FakeArgs() args.instance = instance.serverid args.verbose = instance.verbose args.list_errors = False args.list_checks = False args.check = ['replication', 'backends:userroot:cl_trimming'] args.dry_run = False if json: log.info('Use healthcheck with --json option') args.json = json health_check_run(instance, topology.logcap.log, args) assert topology.logcap.contains(searched_code) log.info('Healthcheck returned searched code: %s' % searched_code) if searched_code2 is not None: assert topology.logcap.contains(searched_code2) log.info('Healthcheck returned searched code: %s' % searched_code2) else: log.info('Use healthcheck without --json option') args.json = json health_check_run(instance, topology.logcap.log, args) assert topology.logcap.contains(searched_code) log.info('Healthcheck returned searched code: %s' % searched_code) if searched_code2 is not None: assert topology.logcap.contains(searched_code2) log.info('Healthcheck returned searched code: %s' % searched_code2) log.info('Clear the log') topology.logcap.flush()
def run_healthcheck_and_flush_log(topology, instance, searched_code=None, json=False, searched_code2=None, list_checks=False, list_errors=False, check=None, searched_list=None): args = FakeArgs() args.instance = instance.serverid args.verbose = instance.verbose args.list_errors = list_errors args.list_checks = list_checks args.check = check args.dry_run = False args.json = json log.info('Use healthcheck with --json == {} option'.format(json)) health_check_run(instance, topology.logcap.log, args) if searched_list is not None: for item in searched_list: assert topology.logcap.contains(item) log.info('Healthcheck returned searched item: %s' % item) else: assert topology.logcap.contains(searched_code) log.info('Healthcheck returned searched code: %s' % searched_code) if searched_code2 is not None: assert topology.logcap.contains(searched_code2) log.info('Healthcheck returned searched code: %s' % searched_code2) log.info('Clear the log') topology.logcap.flush()