Skip to content

Commit d8df93c

Browse files
authored
Downgraded ElasticSearch to version 8 (#590)
ref [INC-275](https://app.incident.io/ghost/incidents/275) Added a test to ensure that the major version of ElasticSearch is the one that we're currently using in production, and won't be accidentally updated by renovate.
1 parent 2507e15 commit d8df93c

3 files changed

Lines changed: 36 additions & 24 deletions

File tree

packages/elasticsearch/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"posttest": "pnpm run lint"
2424
},
2525
"dependencies": {
26-
"@elastic/elasticsearch": "9.3.4",
26+
"@elastic/elasticsearch": "8.19.1",
2727
"@tryghost/debug": "workspace:*",
2828
"split2": "4.2.0"
2929
},

packages/elasticsearch/test/ElasticSearch.test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
const assert = require('assert/strict');
2+
const fs = require('fs');
3+
const path = require('path');
24
const sinon = require('sinon');
35
const sandbox = sinon.createSandbox();
46

57
const { Client } = require('@elastic/elasticsearch');
68
const ElasticSearch = require('../index');
79
const ElasticSearchBunyan = require('../lib/ElasticSearchBunyan');
810

11+
const EXPECTED_ELASTICSEARCH_MAJOR = 8;
12+
const elasticsearchPackage = JSON.parse(
13+
fs.readFileSync(
14+
path.join(path.dirname(require.resolve('@elastic/elasticsearch')), 'package.json'),
15+
'utf8',
16+
),
17+
);
18+
919
const testClientConfig = {
1020
node: 'http://test-elastic-client',
1121
auth: {
@@ -24,6 +34,15 @@ describe('ElasticSearch', function () {
2434
sandbox.restore();
2535
});
2636

37+
it(`Uses @elastic/elasticsearch v${EXPECTED_ELASTICSEARCH_MAJOR}`, function () {
38+
const installedMajor = Number(elasticsearchPackage.version.split('.')[0]);
39+
assert.equal(
40+
installedMajor,
41+
EXPECTED_ELASTICSEARCH_MAJOR,
42+
`Expected @elastic/elasticsearch v${EXPECTED_ELASTICSEARCH_MAJOR}, got v${elasticsearchPackage.version}`,
43+
);
44+
});
45+
2746
it('Processes client configuration', function () {
2847
const es = new ElasticSearch(testClientConfig);
2948

pnpm-lock.yaml

Lines changed: 16 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)