2018-08-12 14:42:09 +00:00
|
|
|
import { expect, tap } from '@pushrocks/tapbundle';
|
|
|
|
import { Qenv } from 'qenv';
|
|
|
|
import * as elasticlog from '../ts/index';
|
2018-01-24 23:38:07 +00:00
|
|
|
|
2018-08-12 14:42:09 +00:00
|
|
|
const testQenv = new Qenv('./', './.nogit/');
|
2018-01-24 23:38:07 +00:00
|
|
|
|
2018-08-12 14:42:09 +00:00
|
|
|
let testElasticLog: elasticlog.ElasticLog<any>;
|
2018-01-24 23:38:07 +00:00
|
|
|
|
|
|
|
tap.test('first test', async () => {
|
|
|
|
testElasticLog = new elasticlog.ElasticLog({
|
|
|
|
domain: process.env.ELK_DOMAIN,
|
|
|
|
port: parseInt(process.env.ELK_PORT, 10),
|
|
|
|
ssl: true,
|
|
|
|
user: process.env.ELK_USER,
|
|
|
|
pass: process.env.ELK_PASS,
|
|
|
|
logContext: {
|
2018-08-12 14:42:09 +00:00
|
|
|
company: 'Lossless GmbH',
|
|
|
|
runtime: 'node',
|
2018-01-24 23:38:07 +00:00
|
|
|
containerName: 'testContainer',
|
|
|
|
environment: 'test'
|
|
|
|
}
|
2018-08-12 14:42:09 +00:00
|
|
|
});
|
|
|
|
expect(testElasticLog).to.be.instanceOf(elasticlog.ElasticLog);
|
|
|
|
});
|
2018-01-24 23:38:07 +00:00
|
|
|
|
|
|
|
tap.test('should send a message to Elasticsearch', async () => {
|
|
|
|
testElasticLog.log({
|
|
|
|
severity: 'log',
|
|
|
|
message: 'hi, this is a testMessage'
|
2018-08-12 14:42:09 +00:00
|
|
|
});
|
|
|
|
});
|
2018-01-24 23:38:07 +00:00
|
|
|
|
2018-08-12 14:42:09 +00:00
|
|
|
tap.start();
|