From e49671eb6dc62ff0adb009160d5d5d5ecc57b532 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 7 Jan 2024 20:33:12 +0100 Subject: [PATCH] Apache Superset: Validate connectivity with Superset 3.x --- .github/workflows/apache-superset.yml | 2 +- framework/apache-superset/conftest.py | 9 ++++++++- framework/apache-superset/requirements.txt | 2 +- framework/apache-superset/superset_config.py | 2 +- framework/apache-superset/test.py | 1 - 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/apache-superset.yml b/.github/workflows/apache-superset.yml index 191e289c..62adda19 100644 --- a/.github/workflows/apache-superset.yml +++ b/.github/workflows/apache-superset.yml @@ -35,7 +35,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-22.04 ] - superset-version: [ "2.*" ] + superset-version: [ "2.*", "3.*" ] python-version: [ "3.11" ] services: diff --git a/framework/apache-superset/conftest.py b/framework/apache-superset/conftest.py index da9d4e98..11f2406e 100644 --- a/framework/apache-superset/conftest.py +++ b/framework/apache-superset/conftest.py @@ -104,7 +104,14 @@ def provision_superset(start_superset): ) assert response.status_code == 201 - assert response.json() == { + payload = response.json() + + # Superset 3 uses UUIDs to identify resources. + # Remove them for comparison purposes. + if "uuid" in payload["result"]: + del payload["result"]["uuid"] + + assert payload == { "id": 1, "result": { "configuration_method": "sqlalchemy_form", diff --git a/framework/apache-superset/requirements.txt b/framework/apache-superset/requirements.txt index ff1589d5..4d7f60d2 100644 --- a/framework/apache-superset/requirements.txt +++ b/framework/apache-superset/requirements.txt @@ -1,3 +1,3 @@ -apache-superset==2.* +apache-superset crate[sqlalchemy]==0.34.0 marshmallow_enum<2 # Seems to be missing from `apache-superset`? diff --git a/framework/apache-superset/superset_config.py b/framework/apache-superset/superset_config.py index 24e16807..f5094b65 100644 --- a/framework/apache-superset/superset_config.py +++ b/framework/apache-superset/superset_config.py @@ -22,7 +22,7 @@ # SQLALCHEMY_DATABASE_URI = 'sqlite:////path/to/superset.db?check_same_thread=false' # Flask-WTF flag for CSRF -WTF_CSRF_ENABLED = True +WTF_CSRF_ENABLED = False # Add endpoints that need to be exempt from CSRF protection WTF_CSRF_EXEMPT_LIST = [] # A CSRF token that expires in 1 year diff --git a/framework/apache-superset/test.py b/framework/apache-superset/test.py index 7b55b426..84f8c7a5 100644 --- a/framework/apache-superset/test.py +++ b/framework/apache-superset/test.py @@ -74,7 +74,6 @@ def test_ui(): html_title = page.text_content("title").strip() assert html_title == "Superset" assert page.url.endswith("/superset/welcome/") - assert page.text_content("h1") == "Home" # Invoke SQL Lab with an example query, and verify response. sql = "SELECT * FROM sys.summits LIMIT 42;"