feat(sqllab): Add timeout on fetching query results (#29959)

This commit is contained in:
JUST.in DO IT
2024-09-12 09:41:28 -07:00
committed by GitHub
parent 23467bd7e4
commit ff3b86b5ff
7 changed files with 70 additions and 10 deletions

View File

@@ -32,6 +32,7 @@ import {
initialState,
user,
queryWithNoQueryLimit,
failedQueryWithFrontendTimeoutErrors,
} from 'src/SqlLab/fixtures';
const mockedProps = {
@@ -104,6 +105,16 @@ const failedQueryWithErrorsState = {
},
},
};
const failedQueryWithTimeoutState = {
...initialState,
sqlLab: {
...initialState.sqlLab,
queries: {
[failedQueryWithFrontendTimeoutErrors.id]:
failedQueryWithFrontendTimeoutErrors,
},
},
};
const newProps = {
displayLimit: 1001,
@@ -319,6 +330,18 @@ describe('ResultSet', () => {
expect(screen.getByText('Database error')).toBeInTheDocument();
});
test('should render a timeout error with a retrial button', async () => {
await waitFor(() => {
setup(
{ ...mockedProps, queryId: failedQueryWithFrontendTimeoutErrors.id },
mockStore(failedQueryWithTimeoutState),
);
});
expect(
screen.getByRole('button', { name: /Retry fetching results/i }),
).toBeInTheDocument();
});
test('renders if there is no limit in query.results but has queryLimit', async () => {
const query = {
...queries[0],