Example #1
0
    def setUp(self):
        """Prepare environment for test."""
        from resolwe.elastic.builder import index_builder

        super().setUp()

        # Prepare Elastic search indices.
        index_builder.discover_indexes()
        index_builder.create_mappings()
        index_builder.unregister_signals()
        index_builder.register_signals()

        # Directories need to be recreated here in case a previous
        # TestCase deleted them. Moving this logic into the test runner
        # and manager infrastructure would not work, because the manager
        # and listener can't know where the testcase boundaries are,
        # they just see a series of data objects; deleting too soon
        # might cause problems for some tests. The runner does not have
        # any code between tests, so could only remove data at the very
        # end, by which time it's already too late, since some tests may
        # deal specifically with the purging functionality and should
        # start in a clean environment, without the sediment
        # (e.g. jsonout.txt, stdout.txt) from previous tests.
        os.makedirs(FLOW_EXECUTOR_SETTINGS['DATA_DIR'], exist_ok=True)
        os.makedirs(FLOW_EXECUTOR_SETTINGS['UPLOAD_DIR'], exist_ok=True)
        os.makedirs(FLOW_EXECUTOR_SETTINGS['RUNTIME_DIR'], exist_ok=True)

        self._keep_data = settings.FLOW_MANAGER_KEEP_DATA

        self.addCleanup(self._clean_up)
Example #2
0
    def handle(self, *args, **options):
        """Command handle."""
        verbosity = int(options['verbosity'])

        if self.has_filter(options):
            self.filter_indices(options, verbosity)
        else:
            # Process all indices.
            index_builder.create_mappings()
Example #3
0
 def test_mapping_multiple_times(self):
     index_builder.create_mappings()
     index_builder.create_mappings()
Example #4
0
 def test_mapping_multiple_times(self):
     index_builder.create_mappings()
     index_builder.create_mappings()