chore: turn on SQLLAB_BACKEND_PERSISTENCE by default (#19107)

* chore: turn on SQLLAB_BACKEND_PERSISTENCE by default

* Rewrite SQL tabs test to make it more rerunnable
This commit is contained in:
Jesse Yang 2022-03-17 21:51:47 -07:00 committed by GitHub
parent aa5c80bda6
commit f6291545fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 74 additions and 83 deletions

View File

@ -38,10 +38,10 @@ default-setup-command() {
}
apt-get-install() {
say "::group::apt-get install dependencies"
sudo apt-get update && sudo apt-get install --yes \
libsasl2-dev
say "::endgroup::"
say "::group::apt-get install dependencies"
sudo apt-get update && sudo apt-get install --yes \
libsasl2-dev
say "::endgroup::"
}
pip-upgrade() {
@ -161,7 +161,7 @@ cypress-run() {
if [[ -z $CYPRESS_KEY ]]; then
$cypress --spec "cypress/integration/$page" --browser "$browser"
else
export CYPRESS_RECORD_KEY=`echo $CYPRESS_KEY | base64 --decode`
export CYPRESS_RECORD_KEY=$(echo $CYPRESS_KEY | base64 --decode)
# additional flags for Cypress dashboard recording
$cypress --spec "cypress/integration/$page" --browser "$browser" \
--record --group "$group" --tag "${GITHUB_REPOSITORY},${GITHUB_EVENT_NAME}" \
@ -190,8 +190,8 @@ cypress-run-all() {
cat "$flasklog"
say "::endgroup::"
# Rerun SQL Lab tests with backend persist enabled
export SUPERSET_CONFIG=tests.integration_tests.superset_test_config_sqllab_backend_persist
# Rerun SQL Lab tests with backend persist disabled
export SUPERSET_CONFIG=tests.integration_tests.superset_test_config_sqllab_backend_persist_off
# Restart Flask with new configs
kill $flaskProcessId

View File

@ -35,10 +35,10 @@ assists people when migrating to a new version.
- [17984](https://github.com/apache/superset/pull/17984): Default Flask SECRET_KEY has changed for security reasons. You should always override with your own secret. Set `PREVIOUS_SECRET_KEY` (ex: PREVIOUS_SECRET_KEY = "\2\1thisismyscretkey\1\2\\e\\y\\y\\h") with your previous key and use `superset re-encrypt-secrets` to rotate you current secrets
- [15254](https://github.com/apache/superset/pull/15254): Previously `QUERY_COST_FORMATTERS_BY_ENGINE`, `SQL_VALIDATORS_BY_ENGINE` and `SCHEDULED_QUERIES` were expected to be defined in the feature flag dictionary in the `config.py` file. These should now be defined as a top-level config, with the feature flag dictionary being reserved for boolean only values.
- [17539](https://github.com/apache/superset/pull/17539): all Superset CLI commands (init, load_examples and etc) require setting the FLASK_APP environment variable (which is set by default when `.flaskenv` is loaded)
- [18970](https://github.com/apache/superset/pull/18970): Changes feature
flag for the legacy datasource editor (DISABLE_LEGACY_DATASOURCE_EDITOR) in config.py to True, thus disabling the feature from being shown in the client.
- [18970](https://github.com/apache/superset/pull/18970): Changes feature flag for the legacy datasource editor (DISABLE_LEGACY_DATASOURCE_EDITOR) in config.py to True, thus disabling the feature from being shown in the client.
- [19017](https://github.com/apache/superset/pull/19017): Removes Python 3.7 support.
- [19142](https://github.com/apache/superset/pull/19142): Changes feature flag for versioned export(VERSIONED_EXPORT) to be true.
- [19107](https://github.com/apache/superset/pull/19107): Feature flag `SQLLAB_BACKEND_PERSISTENCE` is now on by default, which enables persisting SQL Lab tabs in the backend instead of the browser's `localStorage`.
### Potential Downtime

View File

@ -1,65 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
describe('SqlLab query tabs', () => {
beforeEach(() => {
cy.login();
cy.visit('/superset/sqllab');
});
it('allows you to create a tab', () => {
cy.get('[data-test="sql-editor-tabs"]').then(tabList => {
const initialTabCount = tabList.length;
// add tab
cy.get('[data-test="add-tab-icon"]').first().click();
// wait until we find the new tab
cy.get('[data-test="sql-editor-tabs"]')
.children()
.eq(0)
.contains(`Untitled Query ${initialTabCount}`);
cy.get('[data-test="sql-editor-tabs"]')
.children()
.eq(0)
.contains(`Untitled Query ${initialTabCount + 1}`);
});
});
it('allows you to close a tab', () => {
cy.get('[data-test="sql-editor-tabs"]')
.children()
.then(tabListA => {
const initialTabCount = tabListA.length;
// open the tab dropdown to remove
cy.get('[data-test="dropdown-toggle-button"]')
.children()
.first()
.click({
force: true,
});
// first item is close
cy.get('[data-test="close-tab-menu-option"]').click();
cy.get('[data-test="sql-editor-tabs"]').should(
'have.length',
initialTabCount - 1,
);
});
});
});

View File

@ -0,0 +1,60 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
describe('SqlLab query tabs', () => {
beforeEach(() => {
cy.login();
cy.visit('/superset/sqllab');
});
it('allows you to create and close a tab', () => {
const tablistSelector = '[data-test="sql-editor-tabs"] > [role="tablist"]';
const tabSelector = `${tablistSelector} [role="tab"]`;
cy.get(tabSelector).then(tabs => {
const initialTabCount = tabs.length;
const initialUntitledCount = Math.max(
0,
...tabs
.map((i, tabItem) =>
Number(tabItem.textContent?.match(/Untitled Query (\d+)/)?.[1]),
)
.toArray(),
);
// add two new tabs
cy.get('[data-test="add-tab-icon"]:visible:last').click();
cy.contains('[role="tab"]', `Untitled Query ${initialUntitledCount + 1}`);
cy.get(tabSelector).should('have.length', initialTabCount + 1);
cy.get('[data-test="add-tab-icon"]:visible:last').click();
cy.contains('[role="tab"]', `Untitled Query ${initialUntitledCount + 2}`);
cy.get(tabSelector).should('have.length', initialTabCount + 2);
// close the tabs
cy.get(`${tabSelector}:last [data-test="dropdown-trigger"]`).click({
force: true,
});
cy.get('[data-test="close-tab-menu-option"]').click();
cy.get(tabSelector).should('have.length', initialTabCount + 1);
cy.contains('[role="tab"]', `Untitled Query ${initialUntitledCount + 1}`);
cy.get(`${tablistSelector} [aria-label="remove"]:last`).click();
cy.get(tabSelector).should('have.length', initialTabCount);
});
});
});

View File

@ -386,9 +386,7 @@ class TabbedSqlEditors extends React.PureComponent {
);
const tabHeader = (
<TabTitleWrapper>
<div data-test="dropdown-toggle-button">
<Dropdown overlay={menu} trigger={['click']} />
</div>
<Dropdown overlay={menu} trigger={['click']} />
<TabTitle>{qe.title}</TabTitle> <TabStatusIcon tabState={state} />{' '}
</TabTitleWrapper>
);

View File

@ -20,7 +20,7 @@ import React from 'react';
import { styled } from '@superset-ui/core';
import { CheckboxChecked, CheckboxUnchecked } from 'src/components/Checkbox';
interface CheckboxProps {
export interface CheckboxProps {
checked: boolean;
onChange: (val?: boolean) => void;
style?: React.CSSProperties;
@ -49,5 +49,3 @@ export default function Checkbox({ checked, onChange, style }: CheckboxProps) {
</Styles>
);
}
export type { CheckboxProps };

View File

@ -72,7 +72,7 @@ export interface DropdownProps {
export const Dropdown = ({ overlay, ...rest }: DropdownProps) => (
<AntdDropdown overlay={overlay} {...rest}>
<MenuDotsWrapper>
<MenuDotsWrapper data-test="dropdown-trigger">
<MenuDots />
</MenuDotsWrapper>
</AntdDropdown>

View File

@ -391,7 +391,7 @@ DEFAULT_FEATURE_FLAGS: Dict[str, bool] = {
"REMOVE_SLICE_LEVEL_LABEL_COLORS": False,
"SHARE_QUERIES_VIA_KV_STORE": False,
"TAGGING_SYSTEM": False,
"SQLLAB_BACKEND_PERSISTENCE": False,
"SQLLAB_BACKEND_PERSISTENCE": True,
"LISTVIEWS_DEFAULT_CARD_VIEW": False,
# Enables the replacement React views for all the FAB views (list, edit, show) with
# designs introduced in https://github.com/apache/superset/issues/8976

View File

@ -21,4 +21,4 @@ from copy import copy
from .superset_test_config import *
FEATURE_FLAGS = {"SQLLAB_BACKEND_PERSISTENCE": True}
FEATURE_FLAGS = {"SQLLAB_BACKEND_PERSISTENCE": False}