Skip to content

Commit

Permalink
Consistent timeouts for the Space onPostAuth interceptor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kobelb committed Jan 28, 2020
1 parent 7d2074a commit dd09303
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { securityMock } from '../../../../security/server/mocks';

describe('onPostAuthInterceptor', () => {
let root: ReturnType<typeof kbnTestServer.createRoot>;
jest.setTimeout(30000);

const headers = {
authorization: `Basic ${Buffer.from(
Expand All @@ -41,7 +42,7 @@ describe('onPostAuthInterceptor', () => {

beforeEach(async () => {
root = kbnTestServer.createRoot();
}, 30000);
});

afterEach(async () => await root.shutdown());

Expand Down Expand Up @@ -241,7 +242,7 @@ describe('onPostAuthInterceptor', () => {

expect(response.status).toEqual(302);
expect(response.header.location).toEqual(`/spaces/space_selector`);
}, 30000);
});

it('when accessing the kibana app it always allows the request to continue', async () => {
const spaces = [
Expand All @@ -258,7 +259,7 @@ describe('onPostAuthInterceptor', () => {
const { response } = await request('/s/a-space/app/kibana', spaces);

expect(response.status).toEqual(200);
}, 30000);
});

it('allows the request to continue when accessing an API endpoint within a non-existent space', async () => {
const spaces = [
Expand All @@ -274,7 +275,7 @@ describe('onPostAuthInterceptor', () => {
const { response } = await request('/s/not-found/api/test/foo', spaces);

expect(response.status).toEqual(200);
}, 30000);
});
});

describe('requests handled completely in the new platform', () => {
Expand All @@ -293,7 +294,7 @@ describe('onPostAuthInterceptor', () => {

expect(response.status).toEqual(302);
expect(response.header.location).toEqual(`/spaces/space_selector`);
}, 30000);
});

it('allows the request to continue when accessing an API endpoint within a non-existent space', async () => {
const spaces = [
Expand All @@ -309,7 +310,7 @@ describe('onPostAuthInterceptor', () => {
const { response } = await request('/s/not-found/api/np_test/foo', spaces);

expect(response.status).toEqual(200);
}, 30000);
});
});

it('handles space retrieval errors gracefully when requesting the root, responding with headers returned from ES', async () => {
Expand Down Expand Up @@ -421,7 +422,7 @@ describe('onPostAuthInterceptor', () => {
}),
})
);
}, 30000);
});

it('redirects to the "enter space" endpoint when accessing the root of a non-default space', async () => {
const spaces = [
Expand Down Expand Up @@ -454,7 +455,7 @@ describe('onPostAuthInterceptor', () => {
}),
})
);
}, 30000);
});

describe('with a single available space', () => {
it('it redirects to the "enter space" endpoint within the context of the single Space when navigating to Kibana root', async () => {
Expand Down

0 comments on commit dd09303

Please sign in to comment.