-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow passing compressionType and requiredAcks for Kafka notification…
… destinations Issue: BB-620
- Loading branch information
Showing
4 changed files
with
94 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
const assert = require('assert'); | ||
|
||
const configValidator = require('../../../extensions/notification/NotificationConfigValidator'); | ||
|
||
describe('NotificationConfigValidator ::', () => { | ||
it('should throw an error if requiredAcks is specified for a non-kafka destination', () => { | ||
const extConfig = { | ||
topic: 'topic', | ||
monitorNotificationFailures: true, | ||
notificationFailedTopic: 'failed-topic', | ||
queueProcessor: { | ||
groupId: 'groupId', | ||
concurrency: 1000, | ||
}, | ||
destinations: [{ | ||
resource: 'resource', | ||
type: 'other', | ||
host: 'host', | ||
port: 8000, | ||
topic: 'topic', | ||
requiredAcks: 1, | ||
}], | ||
probeServer: { | ||
bindAddress: 'localhost', | ||
port: 8000, | ||
}, | ||
}; | ||
assert.throws(() => configValidator(null, extConfig)); | ||
}); | ||
|
||
it('should throw an error if compressionType is specified for a non-kafka destination', () => { | ||
const extConfig = { | ||
topic: 'topic', | ||
monitorNotificationFailures: true, | ||
notificationFailedTopic: 'failed-topic', | ||
queueProcessor: { | ||
groupId: 'groupId', | ||
concurrency: 1000, | ||
}, | ||
destinations: [{ | ||
resource: 'resource', | ||
type: 'other', | ||
host: 'host', | ||
port: 8000, | ||
topic: 'topic', | ||
compressionType: 'none', | ||
}], | ||
probeServer: { | ||
bindAddress: 'localhost', | ||
port: 8000, | ||
}, | ||
}; | ||
assert.throws(() => configValidator(null, extConfig)); | ||
}); | ||
|
||
it('should not throw an error if requiredAcks and compressionType is specified for a kafka destination', () => { | ||
const extConfig = { | ||
topic: 'topic', | ||
monitorNotificationFailures: true, | ||
notificationFailedTopic: 'failed-topic', | ||
queueProcessor: { | ||
groupId: 'groupId', | ||
concurrency: 1000, | ||
}, | ||
destinations: [{ | ||
resource: 'resource', | ||
type: 'kafka', | ||
host: 'host', | ||
port: 8000, | ||
topic: 'topic', | ||
requiredAcks: 1, | ||
compressionType: 'none', | ||
}], | ||
probeServer: { | ||
bindAddress: 'localhost', | ||
port: 8000, | ||
}, | ||
}; | ||
assert.doesNotThrow(() => configValidator(null, extConfig)); | ||
}); | ||
}); |