Skip to content

Commit

Permalink
No more unknown key errors. Timeouts now
Browse files Browse the repository at this point in the history
  • Loading branch information
John Schulz committed Feb 13, 2020
1 parent 1ca1823 commit 25124c6
Showing 1 changed file with 19 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,42 @@ import * as kbnTestServer from '../../../../../src/test_utils/kbn_server';
// import { IngestManagerConfigType } from '../../common/types';

describe('ingestManager', () => {
describe('GET /ingest_manager/agent_configs', () => {
describe('manager enabled (no EPM, no Fleet)', () => {
let root: ReturnType<typeof kbnTestServer.createRoot>;
beforeAll(async () => {
const ingestManagerConfig = {
enabled: true,
epm: { enabled: true },
epm: { enabled: false },
fleet: { enabled: false },
};
root = kbnTestServer.createRoot({
oss: false,
xpack: ingestManagerConfig,
});
root = kbnTestServer.createRoot(
{
xpack: { ingestManager: ingestManagerConfig },
},
{
oss: false,
}
);
await root.setup();
await root.start();
}, 30000);

afterAll(async () => await root.shutdown());
it('validates given text', async () => {
const response = await kbnTestServer.request
.get(root, '/ingest_manager/agent_configs')
.query({ text: 'input string'.repeat(100) })
.expect(400);

expect(response.body).toHaveProperty('message');
it('has agent config API', async () => {
await kbnTestServer.request.get(root, '/api/ingest_manager/agent_configs').expect(200);
});

it('formats given text', async () => {
const response = await kbnTestServer.request
.get(root, '/ingest_manager/agent_configs')
.query({ text: 'input string' })
.expect(200);
it('has datasources api', async () => {
await kbnTestServer.request.get(root, '/api/ingest_manager/datasources').expect(200);
});

expect(response.text).toBe('...');
it('does not have EPM api', async () => {
await kbnTestServer.request.get(root, '/api/ingest_manager/epm').expect(404);
});

it('returns BadRequest if passed string contains banned symbols', async () => {
await kbnTestServer.request
.get(root, '/ingest_manager/agent_configs')
.query({ text: '<script>' })
.expect(400, 'Text cannot contain unescaped HTML markup.');
it('does not have Fleet api', async () => {
await kbnTestServer.request.get(root, '/api/ingest_manager/fleet').expect(404);
});
});
});

0 comments on commit 25124c6

Please sign in to comment.