-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Bargs/ingest/simulateUpdates
PR Review Updates
- Loading branch information
Showing
14 changed files
with
315 additions
and
278 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
87 changes: 87 additions & 0 deletions
87
...gins/kibana/server/lib/__tests__/converters/ingest_simulate_api_kibana_to_es_converter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import expect from 'expect.js'; | ||
import _ from 'lodash'; | ||
import ingestSimulateApiKibanaToEsConverter from '../../converters/ingest_simulate_api_kibana_to_es_converter'; | ||
|
||
describe('ingestSimulateApiKibanaToEsConverter', function () { | ||
|
||
it('populates the docs._source section and converts known processors', function () { | ||
|
||
function buildSamplePipeline(input) { | ||
return { | ||
processors: [ { processor_id: 'processor1', type_id: 'set', target_field: 'bar', value: 'foo' } ], | ||
input: input | ||
}; | ||
} | ||
|
||
function buildExpected(input) { | ||
return { | ||
pipeline : { | ||
processors: [{ | ||
set: { | ||
field: 'bar', | ||
tag: 'processor1', | ||
value: 'foo' | ||
} | ||
}] | ||
}, | ||
'docs' : [ | ||
{ '_source': input } | ||
] | ||
}; | ||
} | ||
|
||
let expected; | ||
let actual; | ||
|
||
expected = buildExpected(undefined); | ||
actual = ingestSimulateApiKibanaToEsConverter(buildSamplePipeline(undefined)); | ||
expect(actual).to.eql(expected); | ||
|
||
expected = buildExpected('foo'); | ||
actual = ingestSimulateApiKibanaToEsConverter(buildSamplePipeline('foo')); | ||
expect(actual).to.eql(expected); | ||
|
||
expected = buildExpected({ foo: 'bar' }); | ||
actual = ingestSimulateApiKibanaToEsConverter(buildSamplePipeline({ foo: 'bar' })); | ||
expect(actual).to.eql(expected); | ||
}); | ||
|
||
it('handles multiple processors', function () { | ||
const pipeline = { | ||
processors: [ | ||
{ processor_id: 'processor1', type_id: 'set', target_field: 'bar', value: 'foo' }, | ||
{ processor_id: 'processor2', type_id: 'set', target_field: 'bar', value: 'foo' }, | ||
], | ||
input: {} | ||
}; | ||
const expected = { | ||
'pipeline': { | ||
'processors': [ | ||
{ | ||
set: { | ||
field: 'bar', | ||
tag: 'processor1', | ||
value: 'foo' | ||
} | ||
}, | ||
{ | ||
set: { | ||
field: 'bar', | ||
tag: 'processor2', | ||
value: 'foo' | ||
} | ||
} | ||
] | ||
}, | ||
'docs': [ | ||
{'_source': {}} | ||
] | ||
}; | ||
|
||
const actual = ingestSimulateApiKibanaToEsConverter(pipeline); | ||
|
||
expect(actual).to.eql(expected); | ||
}); | ||
|
||
|
||
}); |
158 changes: 0 additions & 158 deletions
158
src/plugins/kibana/server/lib/__tests__/ingest_simulate_build_request.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.