Skip to content

Commit

Permalink
test: Update tests to reflect fixes to milliseconds
Browse files Browse the repository at this point in the history
  • Loading branch information
bmaupin committed Sep 29, 2021
1 parent 07d1ec3 commit 8e39e0a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/produce.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ var msg = syslogProducer.produce({
date: new Date(1234567890000),
message: 'Test Message'
});
assert.equal(msg, "<163>1 2009-02-14T00:31:30.00+01:00 localhost sudo 123 - - Test Message",'Valid message returned');
assert.equal(msg, "<163>1 2009-02-14T00:31:30.000+01:00 localhost sudo 123 - - Test Message",'Valid message returned');

syslogProducer.produce({
facility: 'audit',
severity: 'error',
host: '127.0.0.1',
appName: 'sudo',
pid: '419',
date: new Date(1234567890000),
date: new Date(1234567890001),
message: 'Test Message'
}, function(cbMsg) {
assert.equal(cbMsg, '<107>1 2009-02-14T00:31:30.00+01:00 127.0.0.1 sudo 419 - - Test Message', 'Valid message in callback returned');
assert.equal(cbMsg, '<107>1 2009-02-14T00:31:30.001+01:00 127.0.0.1 sudo 419 - - Test Message', 'Valid message in callback returned');
});

BSDProducer.produce({
Expand Down Expand Up @@ -137,7 +137,7 @@ var structuredMsg = syslogProducer.produce({
host: 'mymachine.example.com',
appName: 'evntslog',
msgID: 'ID47',
date: new Date(1234567890000),
date: new Date(1234567890010),
structuredData: {
'exampleSDID@32473': {
'iut': "3",
Expand All @@ -150,25 +150,25 @@ var structuredMsg = syslogProducer.produce({
});

assert.ok(structuredMsg);
assert.equal(structuredMsg, '<163>1 2009-02-14T00:31:30.00+01:00 mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011" seqNo="1"] BOMAn application event log entry...');
assert.equal(structuredMsg, '<163>1 2009-02-14T00:31:30.010+01:00 mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut="3" eventSource="Application" eventID="1011" seqNo="1"] BOMAn application event log entry...');

var structuredWithArray = syslogProducer.produce({
facility: 'local4',
severity: 'error',
host: 'mymachine.example.com',
appName: 'evntslog',
msgID: 'ID47',
date: new Date(1234567890000),
date: new Date(1234567890100),
structuredData: {
'origin': {
'ip': ['127.0.1.1', '127.0.0.1']
}
},
message: 'BOMAn application event log entry...'
message: 'BOMAn application event log entry...'
});

assert.ok(structuredWithArray);
assert.equal(structuredWithArray, '<163>1 2009-02-14T00:31:30.00+01:00 mymachine.example.com evntslog - ID47 [origin ip="127.0.1.1" ip="127.0.0.1"] BOMAn application event log entry...');
assert.equal(structuredWithArray, '<163>1 2009-02-14T00:31:30.100+01:00 mymachine.example.com evntslog - ID47 [origin ip="127.0.1.1" ip="127.0.0.1"] BOMAn application event log entry...');

var messageWithOneDigitDate = presetProducer.emergency({
facility: 'news',
Expand Down

0 comments on commit 8e39e0a

Please sign in to comment.