Skip to content

Commit

Permalink
Merge pull request #22 from rmothilal/master
Browse files Browse the repository at this point in the history
Updated dependencies
  • Loading branch information
rmothilal authored Mar 3, 2020
2 parents fda3f5d + 6c4cdca commit 63b8fbb
Show file tree
Hide file tree
Showing 8 changed files with 2,042 additions and 1,968 deletions.
596 changes: 351 additions & 245 deletions .circleci/config.yml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .ncurc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"reject": [
"@hapi/hapi",
"@hapi/good",
"@hapi/inert",
"@hapi/vision",
"hapi-swagger"
]
}
19 changes: 1 addition & 18 deletions audit-resolve.json
Original file line number Diff line number Diff line change
@@ -1,18 +1 @@
{
"decisions": {
"1468|blipp>@hapi/hoek": {
"decision": "fix",
"madeAt": 1581603174584
},
"1468|blipp>@hapi/joi>@hapi/hoek": {
"decision": "fix",
"madeAt": 1581603174584
},
"1468|blipp>@hapi/joi>@hapi/topo>@hapi/hoek": {
"decision": "fix",
"madeAt": 1581603174584
}
},
"rules": {},
"version": 1
}
{}
3 changes: 2 additions & 1 deletion config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"queue.buffering.max.messages": 10000000
},
"topicConf": {
"request.required.acks": "all"
"request.required.acks": "all",
"partitioner": "murmur2_random"
}
}
}
Expand Down
3,330 changes: 1,638 additions & 1,692 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "event-sidecar",
"description": "Event Sidecar is used to route an event to Kafka",
"version": "9.1.0",
"version": "9.3.0",
"author": "ModusBox",
"contributors": [
"Rajiv Mothilal <rajiv.mothilal@modusbox.com>",
Expand All @@ -28,30 +28,30 @@
"dependencies": {
"@hapi/address": "4.0.0",
"@hapi/boom": "9.0.0",
"@hapi/good": "9.0.0",
"@hapi/hapi": "19.1.0",
"@hapi/inert": "6.0.1",
"@hapi/vision": "6.0.0",
"@hapi/good": "8.2.4",
"@hapi/hapi": "18.4.1",
"@hapi/inert": "5.2.2",
"@hapi/vision": "5.5.4",
"@mojaloop/central-services-logger": "9.1.0",
"@mojaloop/central-services-metrics": "9.1.0",
"@mojaloop/central-services-stream": "9.1.0",
"@mojaloop/event-sdk": "8.7.0",
"@mojaloop/central-services-stream": "9.2.0",
"@mojaloop/event-sdk": "9.3.0",
"blipp": "4.0.1",
"glob": "7.1.6",
"hapi-openapi": "1.2.6",
"hapi-swagger": "12.1.0",
"hapi-swagger": "11.1.0",
"mustache": "4.0.0",
"uuid4": "1.1.4"
},
"devDependencies": {
"ava": "3.3.0",
"ava": "3.5.0",
"get-port": "5.1.1",
"npm-audit-resolver": "2.2.0",
"npm-check-updates": "4.0.1",
"npm-check-updates": "4.0.3",
"nyc": "15.0.0",
"proxyquire": "2.1.3",
"rewire": "4.0.1",
"sinon": "8.1.1",
"sinon": "9.0.0",
"standard": "14.3.1",
"swagmock": "1.0.0"
},
Expand Down
5 changes: 4 additions & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ const createRPCServer = async () => {
Logger.info(`GRPC Server started at host: ${grpcServer.host}, port: ${grpcServer.port}`)
grpcServer.on(eventSDK.EVENT_RECEIVED, async (eventMessage) => {
Logger.debug('Received eventMessage:', JSON.stringify(eventMessage, null, 2))
Logger.info(`Received Event :: trancastionId: ${eventMessage.metadata.trace.tags.transactionId} :: type: ${eventMessage.metadata.trace.tags.transactionType} :: action: ${eventMessage.metadata.trace.tags.transactionAction} *** Span :: traceId: ${eventMessage.metadata.trace.traceId} :: spanId: ${eventMessage.metadata.trace.spanId} :: tracestate: ${eventMessage.metadata.trace.tags.tracestate}`)
if (!eventMessage.metadata && eventMessage.content && eventMessage.content.trace && eventMessage.content) {
eventMessage.metadata = eventMessage.content
}
Logger.info(`Received Event :: service: ${eventMessage.metadata.trace.service} :: trancastionId: ${eventMessage.metadata.trace.tags.transactionId} :: type: ${eventMessage.metadata.trace.tags.transactionType} :: action: ${eventMessage.metadata.trace.tags.transactionAction} *** Span :: traceId: ${eventMessage.metadata.trace.traceId} :: spanId: ${eventMessage.metadata.trace.spanId} :: tracestate: ${eventMessage.metadata.trace.tags.tracestate}`)
await eventHandler.logEvent(eventMessage)
})
grpcServer.on('error', async (error) => {
Expand Down
30 changes: 30 additions & 0 deletions test/unit/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,33 @@ setupTest.serial('initialize grpc server ', async test => {
}
eventHandlerStub.restore()
})

setupTest.serial('initialize grpc server without metadata', async test => {
const eventHandlerStub = sandbox.stub(eventHandler, 'logEvent')
try {
const { server, grpcServer } = await SetupProxy.initialize()

grpcServer.emit(eventSDK.EVENT_RECEIVED, {
content: {
trace: {
spanId: 'test',
traceId: 'test',
tags: {
transactionAction: 'test',
transactionType: 'test',
tracestate: 'test'
}
}
}
})
// test.assert(eventHandlerStub.calledOnce, 'return server object')
grpcServer.emit('error')
test.assert(server, 'return server object')
// test.assert(HapiStub.Server.called, 'Hapi.Server called once')
test.assert(grpcServer, 'return grpcServer')
} catch (err) {
Logger.error(`init failed with error - ${err}`)
test.fail()
}
eventHandlerStub.restore()
})

0 comments on commit 63b8fbb

Please sign in to comment.