Skip to content

Commit

Permalink
seperate tests to only spawn the needed resoureces, test opensearch v2
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnoble committed Jul 27, 2023
1 parent 2b03e49 commit 1fdb0f5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 77 deletions.
75 changes: 13 additions & 62 deletions .github/workflows/test-asset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,106 +18,57 @@ jobs:
node-version: [14.21.3, 16.19.1, 18.16.0]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
# we login to docker to avoid docker pull limit rates
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- run: yarn setup
- run: yarn lint
- run: yarn --silent --report-coverage false test:legacy
# - run: yarn global add teraslice-cli
# - run: teraslice-cli -v
# - run: teraslice-cli assets build
# - run: ls -l build/

test-es6-linux:
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max-old-space-size=4096"
strategy:
matrix:
# NOTE: Hard Coded Node Version array, should match array in build-and-publish-asset.yml
node-version: [14.21.3, 16.19.1, 18.16.0]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
# we login to docker to avoid docker pull limit rates
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- run: yarn setup
- run: yarn lint
- run: yarn --silent --report-coverage false test:6
# TODO: We should add build back in, but it probably doesn't need to
# happen for each ES version, we just want to make sure a PR doesn't
# break build, see TODO below
# - run: yarn global add teraslice-cli
# - run: teraslice-cli -v
# - run: teraslice-cli assets build
# - run: ls -l build/

test-es7-linux:
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max-old-space-size=4096"
strategy:
matrix:
# NOTE: Hard Coded Node Version array, should match array in build-and-publish-asset.yml
node-version: [14.21.3, 16.19.1, 18.16.0]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
# we login to docker to avoid docker pull limit rates
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- run: yarn setup
- run: yarn lint
- run: yarn --silent --report-coverage false test:7
- run: yarn --silent test:legacy

test-opensearch-1-linux:
test-elasticsearch-assets:
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max-old-space-size=4096"
strategy:
# opensearch is finiky, keep testing others if it fails
fail-fast: false
matrix:
# NOTE: Hard Coded Node Version array, should match array in build-and-publish-asset.yml
node-version: [14.21.3, 16.19.1, 18.16.0]
search-version: [elasticsearch6, elasticsearch7, opensearch1, opensearch2]
steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

# we login to docker to avoid docker pull limit rates
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- run: yarn setup
- run: yarn lint
- run: yarn --silent --report-coverage false test:opensearch

- name: Test ${{ matrix.search-version }}
run: yarn --silent test:${{ matrix.search-version }}


# TODO:
# - Add Macos Test
Expand Down
20 changes: 9 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
"lint:fix": "yarn lint --fix",
"setup": "yarn && yarn build --force",
"test:all": "ts-scripts test",
"test": "ts-scripts test . --",
"test:6": "ELASTICSEARCH_VERSION='6.8.6' yarn run test:all",
"test:7": "ELASTICSEARCH_VERSION='7.9.3' yarn run test:all",
"test:8": "ELASTICSEARCH_VERSION='8.1.2' yarn run test:all",
"test:debug": "ts-scripts test --debug . --",
"test:legacy": "LEGACY_CLIENT=true yarn run test",
"test:opensearch": "TEST_OPENSEARCH='true' yarn run test:all",
"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 . --",
"test:opensearch1": "TEST_OPENSEARCH='true' ts-scripts test . --",
"test:opensearch2": "TEST_OPENSEARCH='true' OPENSEARCH_VERSION='2.8.0' ts-scripts test . --",
"test:watch": "ts-scripts test --watch . --",
"publish:changed": "./scripts/publish.sh"
},
Expand Down Expand Up @@ -73,10 +74,7 @@
"tests": {
"suites": {
"unit": [],
"search": [
"elasticsearch",
"opensearch"
]
"search": []
}
},
"docker": {
Expand Down
13 changes: 9 additions & 4 deletions packages/elasticsearch-asset-apis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@
"scripts": {
"build": "tsc --project tsconfig.json",
"build:watch": "yarn build --watch",
"test": "jest",
"test:watch": "jest --coverage=false --notify --watch --onlyChanged",
"test:debug": "env DEBUG='*teraslice*' jest --detectOpenHandles --coverage=false --runInBand",
"test:7": "ELASTICSEARCH_VERSION=7.x jest"
"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 . --",
"test:opensearch1": "TEST_OPENSEARCH='true' ts-scripts test . --",
"test:opensearch2": "TEST_OPENSEARCH='true' OPENSEARCH_VERSION='2.8.0' ts-scripts test . --",
"test:watch": "ts-scripts test --watch . --"
},
"homepage": "https://github.com/terascope/elasticsearch-assets",
"repository": "[email protected]:terascope/elasticsearch-assets.git",
Expand Down

0 comments on commit 1fdb0f5

Please sign in to comment.