Skip to content

Commit

Permalink
expand the template
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Feb 12, 2025
1 parent df167ce commit 2ddf797
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions test/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,19 @@ describe('templates', function () {
it('saves a composable index template to ES', function (done) {
this.timeout(4000)

this.plugin.load_es_ini()

const filePath = path.resolve('templates', 'index', 'composable.json')
const data = fs.readFileSync(filePath)
const template = JSON.parse(data).index_templates[0].index_template

this.plugin.load_es_ini()

this.plugin.es_connect((err) => {
assert.ifError(err)

const data = fs.readFileSync(filePath)
const template = JSON.parse(data).index_templates[0].index_template

this.plugin.es.indices
.putIndexTemplate({
name: `haraka-results`,
template,
...template,
})
.then((result) => {
console.log(`${f}: ${result}`)

Check warning on line 80 in test/template.js

View workflow job for this annotation

GitHub Actions / lint / lint

'f' is not defined

Check warning on line 80 in test/template.js

View workflow job for this annotation

GitHub Actions / lint / lint

'f' is not defined
Expand Down Expand Up @@ -132,10 +131,9 @@ describe('log_connection', function () {
beforeEach(setup)

it('saves results to Elasticsearch', function (done) {
const plugin = this.plugin

plugin.load_es_ini()
plugin.es_connect(function (err) {
this.plugin.load_es_ini()
this.plugin.es_connect(function (err) {
assert.ifError(err)

console.log('giving ES a few secs to start up')
Expand All @@ -148,7 +146,7 @@ describe('log_connection', function () {
connection.results.add({ name: 'rspamd' }, { msg: 'test' })

// console.log(util.inspect(connection, { depth: null }));
plugin.log_connection(function () {
this.plugin.log_connection(function () {
// assert.ok(1);
done()
}, connection)
Expand Down

0 comments on commit 2ddf797

Please sign in to comment.