2018-08-12 14:42:09 +00:00
|
|
|
import { expect, tap } from '@pushrocks/tapbundle';
|
2018-11-03 19:01:39 +00:00
|
|
|
import { Qenv } from '@pushrocks/qenv';
|
2023-07-04 07:13:14 +00:00
|
|
|
import * as elasticsearch from '../ts/index.js';
|
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-11-07 10:38:53 +00:00
|
|
|
let testElasticLog: elasticsearch.ElasticSearch<any>;
|
2018-01-24 23:38:07 +00:00
|
|
|
|
|
|
|
tap.test('first test', async () => {
|
2018-11-07 10:38:53 +00:00
|
|
|
testElasticLog = new elasticsearch.ElasticSearch({
|
2018-11-10 00:48:44 +00:00
|
|
|
indexPrefix: 'smartlog',
|
|
|
|
indexRetention: 7,
|
2023-07-05 08:25:59 +00:00
|
|
|
node: testQenv.getEnvVarOnDemand('ELK_NODE'),
|
2023-07-05 08:22:53 +00:00
|
|
|
user: '',
|
|
|
|
pass: '',
|
2018-08-12 14:42:09 +00:00
|
|
|
});
|
2023-07-04 07:13:14 +00:00
|
|
|
expect(testElasticLog).toBeInstanceOf(elasticsearch.ElasticSearch);
|
2018-08-12 14:42:09 +00:00
|
|
|
});
|
2018-01-24 23:38:07 +00:00
|
|
|
|
2023-07-05 07:38:43 +00:00
|
|
|
tap.skip.test('should send a message to Elasticsearch', async () => {
|
2018-01-24 23:38:07 +00:00
|
|
|
testElasticLog.log({
|
2018-11-07 10:38:53 +00:00
|
|
|
timestamp: Date.now(),
|
2018-11-03 22:45:21 +00:00
|
|
|
type: 'increment',
|
|
|
|
level: 'info',
|
|
|
|
context: {
|
|
|
|
company: 'Lossless GmbH',
|
|
|
|
companyunit: 'lossless.cloud',
|
|
|
|
containerName: 'testcontainer',
|
|
|
|
environment: 'test',
|
|
|
|
runtime: 'node',
|
2023-07-04 07:13:14 +00:00
|
|
|
zone: 'ship.zone',
|
2018-11-03 22:45:21 +00:00
|
|
|
},
|
2023-07-04 07:13:14 +00:00
|
|
|
message: 'GET https://myroute.to.a.cool.destination/sorare?hello=there',
|
|
|
|
correlation: null,
|
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();
|