def test_get_conf(self, get_conf_from_file_mock): env.roledefs['coordinator'] = 'j' env.roledefs['workers'] = ['K', 'L'] file_conf = {'node.properties': {'my-property': 'value', 'node.environment': 'test'}} get_conf_from_file_mock.return_value = file_conf expected = {'node.properties': {'my-property': 'value', 'node.environment': 'test', 'node.data-dir': '/var/lib/presto/data', 'plugin.config-dir': '/etc/presto/catalog', 'plugin.dir': '/usr/lib/presto/lib/plugin'}, 'jvm.config': ['-server', '-Xmx2G', '-XX:-UseBiasedLocking', '-XX:+UseG1GC', '-XX:+ExplicitGCInvokesConcurrent', '-XX:+HeapDumpOnOutOfMemoryError', '-XX:+UseGCOverheadLimit', '-XX:OnOutOfMemoryError=kill -9 %p', '-DHADOOP_USER_NAME=hive'], 'config.properties': { 'coordinator': 'true', 'discovery-server.enabled': 'true', 'discovery.uri': 'http://j:8080', 'http-server.http.port': '8080', 'node-scheduler.include-coordinator': 'false', 'query.max-memory': '50GB', 'query.max-memory-per-node': '1GB'} } self.assertEqual(coordinator.get_conf(), expected)
def test_get_conf(self, get_conf_from_file_mock): env.roledefs['coordinator'] = "j" env.roledefs['workers'] = ["K", "L"] file_conf = {"node.properties": {"my-property": "value", "node.environment": "test"}} get_conf_from_file_mock.return_value = file_conf expected = {"node.properties": {"my-property": "value", "node.environment": "test", "node.data-dir": "/var/lib/presto/data", "plugin.config-dir": "/etc/presto/catalog", "plugin.dir": "/usr/lib/presto/lib/plugin"}, "jvm.config": ["-server", "-Xmx1G", "-XX:-UseBiasedLocking", "-XX:+UseG1GC", "-XX:+ExplicitGCInvokesConcurrent", "-XX:+HeapDumpOnOutOfMemoryError", "-XX:+UseGCOverheadLimit", "-XX:OnOutOfMemoryError=kill -9 %p"], "config.properties": {"coordinator": "true", "discovery-server.enabled": "true", "discovery.uri": "http://j:8080", "http-server.http.port": "8080", "task.max-memory": "1GB"} } self.assertEqual(coordinator.get_conf(), expected)
def test_get_conf(self, get_conf_from_file_mock): env.roledefs['coordinator'] = 'j' env.roledefs['workers'] = ['K', 'L'] file_conf = { 'node.properties': { 'my-property': 'value', 'node.environment': 'test' } } get_conf_from_file_mock.return_value = file_conf expected = { 'node.properties': { 'my-property': 'value', 'node.environment': 'test', 'node.data-dir': '/var/lib/presto/data', 'plugin.config-dir': '/etc/presto/catalog', 'plugin.dir': '/usr/lib/presto/lib/plugin' }, 'jvm.config': [ '-server', '-Xmx2G', '-XX:-UseBiasedLocking', '-XX:+UseG1GC', '-XX:+ExplicitGCInvokesConcurrent', '-XX:+HeapDumpOnOutOfMemoryError', '-XX:+UseGCOverheadLimit', '-XX:OnOutOfMemoryError=kill -9 %p', '-DHADOOP_USER_NAME=hive' ], 'config.properties': { 'coordinator': 'true', 'discovery-server.enabled': 'true', 'discovery.uri': 'http://j:8080', 'http-server.http.port': '8080', 'node-scheduler.include-coordinator': 'false', 'query.max-memory': '50GB', 'query.max-memory-per-node': '1GB' } } self.assertEqual(coordinator.get_conf(), expected)
def test_get_conf_empty_is_default(self, get_conf_from_file_mock): env.roledefs['coordinator'] = 'j' env.roledefs['workers'] = ['K', 'L'] get_conf_from_file_mock.return_value = {} self.assertEqual(coordinator.get_conf(), coordinator.build_defaults())