mirror of
https://github.com/apache/superset.git
synced 2026-04-21 00:54:44 +00:00
feat(trino): support early cancellation of queries (#22498)
This commit is contained in:
@@ -30,6 +30,7 @@ import {
|
||||
initialState,
|
||||
queryId,
|
||||
} from 'src/SqlLab/fixtures';
|
||||
import { QueryState } from '@superset-ui/core';
|
||||
|
||||
const middlewares = [thunk];
|
||||
const mockStore = configureMockStore(middlewares);
|
||||
@@ -502,6 +503,7 @@ describe('async actions', () => {
|
||||
const results = {
|
||||
data: mockBigNumber,
|
||||
query: { sqlEditorId: 'abcd' },
|
||||
status: QueryState.SUCCESS,
|
||||
query_id: 'efgh',
|
||||
};
|
||||
fetchMock.get(fetchQueryEndpoint, JSON.stringify(results), {
|
||||
@@ -525,6 +527,35 @@ describe('async actions', () => {
|
||||
expect(fetchMock.calls(updateTabStateEndpoint)).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
it("doesn't update the tab state in the backend on stoppped query", () => {
|
||||
expect.assertions(2);
|
||||
|
||||
const results = {
|
||||
status: QueryState.STOPPED,
|
||||
query_id: 'efgh',
|
||||
};
|
||||
fetchMock.get(fetchQueryEndpoint, JSON.stringify(results), {
|
||||
overwriteRoutes: true,
|
||||
});
|
||||
const store = mockStore({});
|
||||
const expectedActions = [
|
||||
{
|
||||
type: actions.REQUEST_QUERY_RESULTS,
|
||||
query,
|
||||
},
|
||||
// missing below
|
||||
{
|
||||
type: actions.QUERY_SUCCESS,
|
||||
query,
|
||||
results,
|
||||
},
|
||||
];
|
||||
return store.dispatch(actions.fetchQueryResults(query)).then(() => {
|
||||
expect(store.getActions()).toEqual(expectedActions);
|
||||
expect(fetchMock.calls(updateTabStateEndpoint)).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('addQueryEditor', () => {
|
||||
|
||||
Reference in New Issue
Block a user