-
Notifications
You must be signed in to change notification settings - Fork 13
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 #889 from terascope/data-entity-conversion
Add kafka to e2e tests and a few fixes
- Loading branch information
Showing
32 changed files
with
284 additions
and
47 deletions.
There are no files selected for viewing
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
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
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
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
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
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,50 @@ | ||
'use strict'; | ||
|
||
const uuidv4 = require('uuid/v4'); | ||
const signale = require('signale'); | ||
const misc = require('../../misc'); | ||
const wait = require('../../wait'); | ||
const { resetState } = require('../../helpers'); | ||
|
||
const { waitForJobStatus, waitForIndexCount } = wait; | ||
|
||
describe('Kafka Tests', () => { | ||
beforeAll(() => resetState()); | ||
|
||
const teraslice = misc.teraslice(); | ||
|
||
it('should be able to read and write from kafka', async () => { | ||
const topic = uuidv4(); | ||
const groupId = uuidv4(); | ||
|
||
const senderSpec = misc.newJob('kafka-sender'); | ||
const readerSpec = misc.newJob('kafka-reader'); | ||
|
||
senderSpec.operations[1].topic = topic; | ||
|
||
readerSpec.operations[0].topic = topic; | ||
readerSpec.operations[0].group = groupId; | ||
const { index } = readerSpec.operations[1]; | ||
|
||
const sender = await teraslice.jobs.submit(senderSpec); | ||
|
||
const [reader] = await Promise.all([ | ||
teraslice.jobs.submit(readerSpec), | ||
waitForJobStatus(sender, 'completed'), | ||
]); | ||
|
||
await waitForIndexCount(index, 10); | ||
await reader.stop(); | ||
|
||
await waitForJobStatus(reader, 'stopped'); | ||
|
||
let count = 0; | ||
try { | ||
({ count } = await misc.indexStats(index)); | ||
} catch (err) { | ||
signale.error(err); | ||
} | ||
|
||
expect(count).toBe(10); | ||
}); | ||
}); |
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
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
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,28 @@ | ||
{ | ||
"name": "Kafka Reader", | ||
"lifecycle": "persistent", | ||
"workers": 1, | ||
"analytics": true, | ||
"assets": ["kafka", "elasticsearch"], | ||
"operations": [ | ||
{ | ||
"_op": "teraslice_kafka_reader", | ||
"connection": "default", | ||
"topic": "example-logs-10", | ||
"group": "example-kafka-group", | ||
"size": 10, | ||
"wait": 5000, | ||
"_encoding": "json" | ||
}, | ||
{ | ||
"_op": "elasticsearch_index_selector", | ||
"type": "events", | ||
"index": "kafka-logs-10", | ||
"preserve_id": true | ||
}, | ||
{ | ||
"_op": "elasticsearch_bulk", | ||
"size": 10 | ||
} | ||
] | ||
} |
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,25 @@ | ||
{ | ||
"name": "Kafka Sender", | ||
"lifecycle": "once", | ||
"workers": 1, | ||
"analytics": true, | ||
"assets": ["kafka", "elasticsearch"], | ||
"operations": [ | ||
{ | ||
"_op": "elasticsearch_reader", | ||
"index": "example-logs-10", | ||
"type": "events", | ||
"size": 10, | ||
"date_field_name": "created", | ||
"preserve_id": true | ||
}, | ||
{ | ||
"_op": "teraslice_kafka_sender", | ||
"connection": "default", | ||
"topic": "example-logs-10", | ||
"size": 10, | ||
"timestamp_field": "created", | ||
"_encoding": "json" | ||
} | ||
] | ||
} |
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
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
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
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
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
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
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
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
Oops, something went wrong.