mirror of https://github.com/apache/superset.git
fetch datasources from broker endpoint when refresh new datasources (#5183)
* fetch datasources from broker endpoint when refresh new datasources * remove get_base_coordinator_url as out of use * add broker_endpoint in get_test_cluster_obj
This commit is contained in:
parent
502b617310
commit
7f30b48955
|
@ -121,10 +121,10 @@ class DruidCluster(Model, AuditMixinNullable, ImportMixin):
|
|||
url = '{0}:{1}'.format(host, port) if port else host
|
||||
return url
|
||||
|
||||
def get_base_coordinator_url(self):
|
||||
def get_base_broker_url(self):
|
||||
base_url = self.get_base_url(
|
||||
self.coordinator_host, self.coordinator_port)
|
||||
return '{base_url}/{self.coordinator_endpoint}'.format(**locals())
|
||||
self.broker_host, self.broker_port)
|
||||
return '{base_url}/{self.broker_endpoint}'.format(**locals())
|
||||
|
||||
def get_pydruid_client(self):
|
||||
cli = PyDruid(
|
||||
|
@ -133,7 +133,7 @@ class DruidCluster(Model, AuditMixinNullable, ImportMixin):
|
|||
return cli
|
||||
|
||||
def get_datasources(self):
|
||||
endpoint = self.get_base_coordinator_url() + '/datasources'
|
||||
endpoint = self.get_base_broker_url() + '/datasources'
|
||||
return json.loads(requests.get(endpoint).text)
|
||||
|
||||
def get_druid_version(self):
|
||||
|
|
|
@ -94,6 +94,7 @@ class DruidTests(SupersetTestCase):
|
|||
coordinator_port=7979,
|
||||
broker_host='localhost',
|
||||
broker_port=7980,
|
||||
broker_endpoint='druid/v2',
|
||||
metadata_last_refreshed=datetime.now())
|
||||
|
||||
def get_cluster(self, PyDruid):
|
||||
|
@ -456,8 +457,8 @@ class DruidTests(SupersetTestCase):
|
|||
'https://localhost:9999')
|
||||
|
||||
self.assertEquals(
|
||||
cluster.get_base_coordinator_url(),
|
||||
'http://localhost:7979/druid/coordinator/v1/metadata')
|
||||
cluster.get_base_broker_url(),
|
||||
'http://localhost:7980/druid/v2')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue