def test_is_version_identifier(self): self.assertFalse(versions.is_version_identifier(None)) self.assertFalse(versions.is_version_identifier("")) self.assertFalse(versions.is_version_identifier(" \t ")) self.assertFalse(versions.is_version_identifier("5-ab-c")) self.assertTrue(versions.is_version_identifier("5.0.0")) self.assertTrue(versions.is_version_identifier("1.7.3")) self.assertTrue(versions.is_version_identifier("20.3.7-SNAPSHOT"))
def number_of_nodes(self, car): distribution_version = self._config.opts("source", "distribution.version", mandatory=False) configure = False if versions.is_version_identifier(distribution_version): major, _, _, _ = versions.components(distribution_version) if major >= 2: configure = True else: # we're very likely benchmarking from sources which is ES 5+ configure = True return "\nnode.max_local_storage_nodes: %d" % car.nodes if configure else ""
def number_of_nodes(self, car): distribution_version = self._config.opts("source", "distribution.version", mandatory=False) configure = False if versions.is_version_identifier(distribution_version): major, _, _, _ = versions.components(distribution_version) if major >= 2: configure = True else: # we're very likely benchmarking from sources which is ES 5+ configure = True return "\nnode.max_local_storage_nodes: %d" % car.nodes if configure else ""
def _es_log_config(self): logging_yml_path = "%s/config/logging.yml" % self.binary_path log4j2_properties_path = "%s/config/log4j2.properties" % self.binary_path if os.path.isfile(logging_yml_path): return "logging.yml", logging_yml_path elif os.path.isfile(log4j2_properties_path): distribution_version = self._config.opts("mechanic", "distribution.version", mandatory=False) if versions.is_version_identifier(distribution_version): if versions.major_version(distribution_version) == 5: return "log4j2.properties.5", log4j2_properties_path else: return "log4j2.properties", log4j2_properties_path else: raise exceptions.SystemSetupError( "Unrecognized Elasticsearch log config file format")
def test_is_version_identifier(self): assert versions.is_version_identifier(None) is False assert versions.is_version_identifier("") is False assert versions.is_version_identifier(" \t ") is False assert versions.is_version_identifier("5-ab-c") is False assert versions.is_version_identifier("5.1") is False assert versions.is_version_identifier("5") is False assert versions.is_version_identifier("5.0.0") assert versions.is_version_identifier("1.7.3") assert versions.is_version_identifier("20.3.7-SNAPSHOT") assert versions.is_version_identifier(None, strict=False) is False assert versions.is_version_identifier("", strict=False) is False assert versions.is_version_identifier("5.1", strict=False) assert versions.is_version_identifier("5", strict=False) assert versions.is_version_identifier("23", strict=False) assert versions.is_version_identifier("20.3.7-SNAPSHOT", strict=False)
def test_is_version_identifier(self): self.assertFalse(versions.is_version_identifier(None)) self.assertFalse(versions.is_version_identifier("")) self.assertFalse(versions.is_version_identifier(" \t ")) self.assertFalse(versions.is_version_identifier("5-ab-c")) self.assertFalse(versions.is_version_identifier("5.1")) self.assertFalse(versions.is_version_identifier("5")) self.assertTrue(versions.is_version_identifier("5.0.0")) self.assertTrue(versions.is_version_identifier("1.7.3")) self.assertTrue(versions.is_version_identifier("20.3.7-SNAPSHOT")) self.assertFalse(versions.is_version_identifier(None, strict=False)) self.assertFalse(versions.is_version_identifier("", strict=False)) self.assertTrue(versions.is_version_identifier("5.1", strict=False)) self.assertTrue(versions.is_version_identifier("5", strict=False)) self.assertTrue(versions.is_version_identifier("23", strict=False)) self.assertTrue(versions.is_version_identifier("20.3.7-SNAPSHOT", strict=False))