Skip to content

Commit

Permalink
Disable deprecated druid connector by default (#8512)
Browse files Browse the repository at this point in the history
* Disable deprecated druid connector by default

* Add a line in UPDATING.md for the configuration change

* Remove security tests related default-disabled feature

* More test updates

* black
  • Loading branch information
Will Barrett authored and mistercrunch committed Nov 27, 2019
1 parent 172b90e commit 16c0599
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
4 changes: 4 additions & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ assists people when migrating to a new version.

## 0.35.0

* [8512](https://github.com/apache/incubator-superset/pull/8512): `DRUID_IS_ACTIVE` now
defaults to False. To enable Druid-API-based functionality, override the
`DRUID_IS_ACTIVE` configuration variable by setting it to `True` for your deployment.

* [8450](https://github.com/apache/incubator-superset/pull/8450): The time ranger picker
now uses UTC for the tooltips and default placeholder timestamps (sans timezone).

Expand Down
7 changes: 6 additions & 1 deletion superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,15 @@ def _try_json_readsha(filepath):
# [TimeZone List]
# See: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# other tz can be overridden by providing a local_config
DRUID_IS_ACTIVE = True
DRUID_TZ = tz.tzutc()
DRUID_ANALYSIS_TYPES = ["cardinality"]

# Legacy Druid connector
# Druid supports a SQL interface in its newer versions.
# Setting this flag to True enables the deprecated, API-based Druid
# connector. This feature may be removed at a future date.
DRUID_IS_ACTIVE = False

# ----------------------------------------------------
# AUTHENTICATION CONFIG
# ----------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions tests/druid_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from unittest.mock import Mock, patch

from superset import db, security_manager
from tests.test_app import app

from .base_tests import SupersetTestCase

Expand Down Expand Up @@ -297,6 +298,7 @@ def check():
@unittest.skipUnless(
SupersetTestCase.is_module_installed("pydruid"), "pydruid not installed"
)
@unittest.skipUnless(app.config["DRUID_IS_ACTIVE"], "DRUID_IS_ACTIVE is false")
def test_filter_druid_datasource(self):
CLUSTER_NAME = "new_druid"
cluster = self.get_or_create(
Expand Down
19 changes: 0 additions & 19 deletions tests/security_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ def assert_can_all(self, view_menu, permissions_set):
self.assert_can_read(view_menu, permissions_set)
self.assert_can_write(view_menu, permissions_set)

def assert_cannot_gamma(self, perm_set):
self.assert_cannot_write("DruidColumnInlineView", perm_set)

def assert_can_gamma(self, perm_set):
self.assert_can_read("DatabaseAsync", perm_set)
self.assert_can_read("TableModelView", perm_set)
Expand Down Expand Up @@ -86,12 +83,8 @@ def assert_can_alpha(self, perm_set):
self.assert_can_all("SqlMetricInlineView", perm_set)
self.assert_can_all("TableColumnInlineView", perm_set)
self.assert_can_all("TableModelView", perm_set)
self.assert_can_all("DruidColumnInlineView", perm_set)
self.assert_can_all("DruidDatasourceModelView", perm_set)
self.assert_can_all("DruidMetricInlineView", perm_set)

self.assertIn(("all_datasource_access", "all_datasource_access"), perm_set)
self.assertIn(("muldelete", "DruidDatasourceModelView"), perm_set)

def assert_cannot_alpha(self, perm_set):
if app.config["ENABLE_ACCESS_REQUEST"]:
Expand All @@ -104,7 +97,6 @@ def assert_cannot_alpha(self, perm_set):
def assert_can_admin(self, perm_set):
self.assert_can_read("DatabaseAsync", perm_set)
self.assert_can_all("DatabaseView", perm_set)
self.assert_can_all("DruidClusterModelView", perm_set)
self.assert_can_all("RoleModelView", perm_set)
self.assert_can_all("UserDBModelView", perm_set)

Expand Down Expand Up @@ -185,13 +177,6 @@ def test_is_alpha_only(self):
)
)
)
self.assertTrue(
security_manager._is_alpha_only(
security_manager.find_permission_view_menu(
"can_delete", "DruidMetricInlineView"
)
)
)
self.assertTrue(
security_manager._is_alpha_only(
security_manager.find_permission_view_menu(
Expand All @@ -209,7 +194,6 @@ def test_is_gamma_pvm(self):

def test_gamma_permissions_basic(self):
self.assert_can_gamma(get_perm_tuples("Gamma"))
self.assert_cannot_gamma(get_perm_tuples("Gamma"))
self.assert_cannot_alpha(get_perm_tuples("Alpha"))

@unittest.skipUnless(
Expand All @@ -234,15 +218,13 @@ def test_sql_lab_permissions(self):
self.assertIn(("can_csv", "Superset"), sql_lab_set)
self.assertIn(("can_search_queries", "Superset"), sql_lab_set)

self.assert_cannot_gamma(sql_lab_set)
self.assert_cannot_alpha(sql_lab_set)

def test_granter_permissions(self):
granter_set = get_perm_tuples("granter")
self.assertIn(("can_override_role_permissions", "Superset"), granter_set)
self.assertIn(("can_approve", "Superset"), granter_set)

self.assert_cannot_gamma(granter_set)
self.assert_cannot_alpha(granter_set)

def test_gamma_permissions(self):
Expand Down Expand Up @@ -273,7 +255,6 @@ def assert_can_all(view_menu):

# check read only perms
assert_can_read("TableModelView")
assert_cannot_write("DruidColumnInlineView")

# make sure that user can create slices and dashboards
assert_can_all("SliceModelView")
Expand Down

0 comments on commit 16c0599

Please sign in to comment.