Skip to content

Commit

Permalink
Merge pull request #3374 from terascope/e2e-opensearch
Browse files Browse the repository at this point in the history
support to test opensearch v2 and elasticsearch7 for e2e tests
  • Loading branch information
jsnoble authored Jul 24, 2023
2 parents 9e7fc55 + bcfa329 commit f682a18
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 48 deletions.
52 changes: 12 additions & 40 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
strategy:
matrix:
node-version: [14.21.3, 16.19.1, 18.16.0]
search-version: [elasticsearch6, elasticsearch7, opensearch1, opensearch2]
steps:
- name: Check out code
uses: actions/checkout@v3
Expand All @@ -78,27 +79,16 @@ jobs:
env:
YARN_SETUP_ARGS: "--prod=false --silent"

- name: Test elasticsearch 6
run: yarn --silent test
working-directory: ./packages/teraslice

- name: Test elasticsearch 7
run: yarn --silent test:elasticsearch7
working-directory: ./packages/teraslice

- name: Test opensearch 1.3
run: yarn --silent test:opensearch1
working-directory: ./packages/teraslice

- name: Test opensearch 2.8
run: yarn --silent test:opensearch2
- name: Test ${{ matrix.search-version }}
run: yarn --silent test:${{ matrix.search-version }}
working-directory: ./packages/teraslice

elasticsearch-store-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.21.3, 16.19.1, 18.16.0]
search-version: [elasticsearch6, elasticsearch7, opensearch1, opensearch2]
steps:
- name: Check out code
uses: actions/checkout@v3
Expand All @@ -121,20 +111,8 @@ jobs:
env:
YARN_SETUP_ARGS: "--prod=false --silent"

- name: Test elasticsearch 6
run: yarn --silent test
working-directory: ./packages/elasticsearch-store

- name: Test elasticsearch 7
run: yarn --silent test:elasticsearch7
working-directory: ./packages/elasticsearch-store

- name: Test opensearch 1.3
run: yarn --silent test:opensearch1
working-directory: ./packages/elasticsearch-store

- name: Test opensearch 2.8
run: yarn --silent test:opensearch2
- name: Test ${{ matrix.search-version }}
run: yarn --silent test:${{ matrix.search-version }}
working-directory: ./packages/elasticsearch-store

# This is for backwards compatability, should be removed in the future
Expand Down Expand Up @@ -171,6 +149,7 @@ jobs:
strategy:
matrix:
node-version: [14.21.3, 16.19.1, 18.16.0]
search-version: [elasticsearch6, elasticsearch7, opensearch1, opensearch2]
steps:
- name: Check out code
uses: actions/checkout@v3
Expand All @@ -193,16 +172,8 @@ jobs:
env:
YARN_SETUP_ARGS: "--prod=false --silent"

- name: Test elasticsearch 6
run: yarn --silent test
working-directory: ./packages/elasticsearch-api

- name: Test elasticsearch 7
run: yarn --silent test:7
working-directory: ./packages/elasticsearch-api

- name: Test opensearch
run: yarn --silent test:opensearch
- name: Test ${{ matrix.search-version }}
run: yarn --silent test:${{ matrix.search-version }}
working-directory: ./packages/elasticsearch-api


Expand Down Expand Up @@ -240,6 +211,7 @@ jobs:
strategy:
matrix:
node-version: [14.21.3, 16.19.1, 18.16.0]
search-version: [elasticsearch6, elasticsearch7, opensearch1, opensearch2]
steps:
- name: Check out code
uses: actions/checkout@v3
Expand All @@ -262,6 +234,6 @@ jobs:
env:
YARN_SETUP_ARGS: "--prod=false --silent"

- name: Test
run: yarn --silent test
- name: Test ${{ matrix.search-version }}
run: yarn --silent test:${{ matrix.search-version }}
working-directory: ./e2e
4 changes: 4 additions & 0 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
"setup": "yarn --silent",
"test": "TEST_ELASTICSEARCH='true' TEST_KAFKA='true' ts-scripts test --suite e2e --",
"test:debug": "TEST_ELASTICSEARCH='true' TEST_KAFKA='true' ts-scripts test --suite e2e --debug --",
"test:elasticsearch6": "TEST_ELASTICSEARCH='true' TEST_KAFKA='true' ts-scripts test --suite e2e --",
"test:elasticsearch7": "TEST_ELASTICSEARCH='true' ELASTICSEARCH_VERSION='7.9.3' TEST_KAFKA='true' ts-scripts test --suite e2e --",
"test:opensearch1": "TEST_OPENSEARCH='true' TEST_KAFKA='true' ts-scripts test --suite e2e --",
"test:opensearch2": "TEST_OPENSEARCH='true' OPENSEARCH_VERSION='2.8.0' TEST_KAFKA='true' ts-scripts test --suite e2e --",
"test:watch": "TEST_ELASTICSEARCH='true' TEST_KAFKA='true' ts-scripts test --suite e2e --watch --"
},
"resolutions": {
Expand Down
2 changes: 1 addition & 1 deletion e2e/test/cases/data/reindex-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('reindex', () => {
// as there are no records
await terasliceHarness.indexStats(specIndex).catch((errResponse) => {
const reason = get(errResponse, 'body.error.reason');
expect(reason).toEqual('no such index');
expect(reason).toContain('no such index');
});
});

Expand Down
6 changes: 5 additions & 1 deletion e2e/test/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ const WORKERS_PER_NODE = 8;
const {
KAFKA_BROKER = 'locahost:9092',
HOST_IP = '127.0.0.1',
GENERATE_ONLY
GENERATE_ONLY,
TEST_OPENSEARCH = false
} = process.env;

const TEST_HOST = TEST_OPENSEARCH ? OPENSEARCH_HOST : ELASTICSEARCH_HOST;

function newId(prefix, lowerCase = false, length = 15) {
let characters = '0123456789abcdefghijklmnopqrstuvwxyz';

Expand Down Expand Up @@ -73,4 +76,5 @@ module.exports = {
OPENSEARCH_VERSION,
GENERATE_ONLY,
newId,
TEST_HOST
};
3 changes: 2 additions & 1 deletion e2e/test/setup-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const {
WORKERS_PER_NODE,
KAFKA_BROKER,
ELASTICSEARCH_HOST,
TEST_HOST,
ELASTICSEARCH_API_VERSION,
CLUSTER_NAME,
HOST_IP,
Expand Down Expand Up @@ -40,7 +41,7 @@ module.exports = async function setupTerasliceConfig() {
},
'elasticsearch-next': {
default: {
node: [ELASTICSEARCH_HOST],
node: [TEST_HOST],
requestTimeout: '1 minute',
sniffOnStart: false,
sniffOnConnectionFault: false,
Expand Down
4 changes: 2 additions & 2 deletions e2e/test/teraslice-harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { TerasliceClient } = require('teraslice-client-js');
const path = require('path');
const fse = require('fs-extra');
const {
ELASTICSEARCH_HOST, HOST_IP, SPEC_INDEX_PREFIX,
TEST_HOST, HOST_IP, SPEC_INDEX_PREFIX,
DEFAULT_NODES, newId, DEFAULT_WORKERS, GENERATE_ONLY,
EXAMPLE_INDEX_SIZES, EXAMPLE_INDEX_PREFIX
} = require('./config');
Expand All @@ -23,7 +23,7 @@ const generateOnly = GENERATE_ONLY ? parseInt(GENERATE_ONLY, 10) : null;

module.exports = class TerasliceHarness {
async init() {
const { client } = await createClient({ node: ELASTICSEARCH_HOST });
const { client } = await createClient({ node: TEST_HOST });
this.client = client;
this.teraslice = new TerasliceClient({
host: `http://${HOST_IP}:45678`,
Expand Down
8 changes: 5 additions & 3 deletions packages/elasticsearch-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
"typings": "types/index.d.ts",
"scripts": {
"test": "TEST_RESTRAINED_ELASTICSEARCH='true' ts-scripts test . --",
"test:7": "TEST_RESTRAINED_ELASTICSEARCH='true' ELASTICSEARCH_VERSION='7.9.3' ts-scripts test . --",
"test:8": "TEST_RESTRAINED_ELASTICSEARCH='true' ELASTICSEARCH_VERSION='8.1.2' ts-scripts test . --",
"test:debug": "TEST_RESTRAINED_ELASTICSEARCH='true' ts-scripts test --debug . --",
"test:elasticsearch6": "TEST_RESTRAINED_ELASTICSEARCH='true' ts-scripts test . --",
"test:elasticsearch7": "TEST_RESTRAINED_ELASTICSEARCH='true' ELASTICSEARCH_VERSION='7.9.3' ts-scripts test . --",
"test:elasticsearch8": "TEST_RESTRAINED_ELASTICSEARCH='true' ELASTICSEARCH_VERSION='8.1.2' ts-scripts test . --",
"test:legacy": "TEST_RESTRAINED_ELASTICSEARCH='true' LEGACY_CLIENT=true ts-scripts test . --",
"test:opensearch": "TEST_RESTRAINED_OPENSEARCH='true' ts-scripts test --debug . --",
"test:opensearch1": "TEST_RESTRAINED_OPENSEARCH='true' ts-scripts test --debug . --",
"test:opensearch2": "TEST_RESTRAINED_OPENSEARCH='true' OPENSEARCH_VERSION='2.8.0' ts-scripts test --debug . --",
"test:watch": "TEST_RESTRAINED_ELASTICSEARCH='true' ts-scripts test --watch . --"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/elasticsearch-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"build:watch": "yarn build --watch",
"test": "TEST_ELASTICSEARCH='true' ts-scripts test . --",
"test:debug": "TEST_ELASTICSEARCH='true' ts-scripts test --debug . --",
"test:elasticsearch6": "TEST_ELASTICSEARCH='true' ts-scripts test . --",
"test:elasticsearch7": "TEST_ELASTICSEARCH='true' ELASTICSEARCH_VERSION='7.9.3' ts-scripts test . --",
"test:elasticsearch8": "TEST_ELASTICSEARCH='true' ELASTICSEARCH_VERSION='8.1.2' ts-scripts test . --",
"test:legacy": "TEST_ELASTICSEARCH='true' LEGACY_CLIENT=true ts-scripts test . --",
Expand Down
1 change: 1 addition & 0 deletions packages/teraslice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"start": "node service.js",
"test": "TEST_ELASTICSEARCH='true' ts-scripts test . --",
"test:debug": "TEST_ELASTICSEARCH='true' ts-scripts test --debug . --",
"test:elasticsearch6": "TEST_ELASTICSEARCH='true' ts-scripts test . --",
"test:elasticsearch7": "TEST_ELASTICSEARCH='true' ELASTICSEARCH_VERSION='7.9.3' ts-scripts test . --",
"test:opensearch1": "TEST_OPENSEARCH='true' ts-scripts test . --",
"test:opensearch2": "TEST_OPENSEARCH='true' OPENSEARCH_VERSION='2.8.0' ts-scripts test . --",
Expand Down

0 comments on commit f682a18

Please sign in to comment.