<commit_before>import unittest
import tempfile
import logging
import shutil
import os.path
from tenacity import RetryError

import sdcm.cluster
from sdcm.utils.common import Distro


class DummyNode(sdcm.cluster.BaseNode):  # pylint: disable=abstract-method

    @property
    def private_ip_address(self):
        # Expected node name like : node1, node2, node3 ...
        return '127.0.0.%s' % self.name.replace('node', '')

    @property
    def public_ip_address(self):
        # Expected node name like : node1, node2, node3 ...
        return '127.0.0.%s' % self.name.replace('node', '')

    @property
    def ip_address(self):
        # Expected node name like : node1, node2, node3 ...
        return '127.0.0.%s' % self.name.replace('node', '')


class DummyCluster(sdcm.cluster.BaseScyllaCluster):
    def __init__(self, *args, **kwargs):
        self.params = {}
        self.nodes = []
        super(DummyCluster, self).__init__(*args, **kwargs)

    def set_test_params(self, seeds_selector, seeds_num, db_type):
        self.params = {'seeds_selector': seeds_selector, 'seeds_num': seeds_num, 'db_type': db_type}


class DummeyOutput(object):  # pylint: disable=too-few-public-methods
    def __init__(self, stdout):
        self.stdout = stdout


class DummyRemote(object):  # pylint: disable=too-few-public-methods
    def run(self, *args, **kwargs):  # pylint: disable=no-self-use
        logging.info(args, kwargs)
        return DummeyOutput(args[0])

    @staticmethod
    def is_up():
        return True

    @staticmethod
    def receive_files(src, dst):
        shutil.copy(src, dst)


logging.basicConfig(format="%(asctime)s - %(levelname)-8s - %(name)-10s: %(message)s", level=logging.DEBUG)


class TestSeedSelector(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.temp_dir = tempfile.mkdtemp()
        cls.cluster = None

    @classmethod
    def tearDownClass(cls):
        # stop_events_device()
        shutil.rmtree(cls.temp_dir)

    def setup_cluster(self, nodes_number):<commit_msg>Fix reflector unit test in seed selection (receive_files function should return status) (#1405)<commit_after>import unittest
import tempfile
import logging
import shutil
import os.path
from tenacity import RetryError

import sdcm.cluster
from sdcm.utils.common import Distro


class DummyNode(sdcm.cluster.BaseNode):  # pylint: disable=abstract-method

    @property
    def private_ip_address(self):
        # Expected node name like : node1, node2, node3 ...
        return '127.0.0.%s' % self.name.replace('node', '')

    @property
    def public_ip_address(self):
        # Expected node name like : node1, node2, node3 ...
        return '127.0.0.%s' % self.name.replace('node', '')

    @property
    def ip_address(self):
        # Expected node name like : node1, node2, node3 ...
        return '127.0.0.%s' % self.name.replace('node', '')


class DummyCluster(sdcm.cluster.BaseScyllaCluster):
    def __init__(self, *args, **kwargs):
        self.params = {}
        self.nodes = []
        super(DummyCluster, self).__init__(*args, **kwargs)

    def set_test_params(self, seeds_selector, seeds_num, db_type):
        self.params = {'seeds_selector': seeds_selector, 'seeds_num': seeds_num, 'db_type': db_type}


class DummeyOutput(object):  # pylint: disable=too-few-public-methods
    def __init__(self, stdout):
        self.stdout = stdout


class DummyRemote(object):  # pylint: disable=too-few-public-methods
    def run(self, *args, **kwargs):  # pylint: disable=no-self-use
        logging.info(args, kwargs)
        return DummeyOutput(args[0])

    @staticmethod
    def is_up():
        return True

    @staticmethod
    def receive_files(src, dst):
        shutil.copy(src, dst)
        return True


logging.basicConfig(format="%(asctime)s - %(levelname)-8s - %(name)-10s: %(message)s", level=logging.DEBUG)


class TestSeedSelector(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.temp_dir = tempfile.mkdtemp()
        cls.cluster = None

    @classmethod
    def tearDownClass(cls):
        # stop_events_device()
        shutil.rmtree(cls.temp_dir)

    def setup_cluster(self, nodes_number):
{'fraction_non_alphanumeric': 0.12666984732824427, 'fraction_numerical': 0.01431297709923664, 'mean_word_length': 3.2225579053373616, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3082414', 'n_tokens_mistral': 1417, 'n_tokens_neox': 1349, 'n_words': 297}