Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Add CI for e2e (#208)
Browse files Browse the repository at this point in the history
* Add CI for e2e
  • Loading branch information
yizheliu-amazon authored Jun 23, 2020
1 parent bba3f30 commit beb8f89
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
67 changes: 67 additions & 0 deletions .github/workflows/e2e-tests-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: E2E tests workflow
on:
push:
branches:
- master
jobs:
tests:
name: Run e2e tests
strategy:
matrix:
os: [ubuntu-16.04] # use ubuntu-16.04 as required by cypress: https://github.com/marketplace/actions/cypress-io#important
java: [14]
runs-on: ${{ matrix.os }}
steps:
- name: Pull and Run Docker
run: |
version=1.8.0
echo $version
if docker pull opendistroforelasticsearch/opendistroforelasticsearch:$version
then
echo "FROM opendistroforelasticsearch/opendistroforelasticsearch:$version" >> Dockerfile
## The ESRestTest Client uses http by default.
## Need to disable the security plugin to call the rest api over http.
echo "RUN if [ -d /usr/share/elasticsearch/plugins/opendistro_security ]; then /usr/share/elasticsearch/bin/elasticsearch-plugin remove opendistro_security; fi" >> Dockerfile
docker build -t odfe-ad:test .
fi
- name: Run Docker Image
run: |
docker run -p 9200:9200 -d -p 9600:9600 -e "discovery.type=single-node" odfe-ad:test
sleep 90
curl -XGET http://localhost:9200/_cat/plugins
- name: Checkout Kibana
uses: actions/checkout@v2
with:
repository: opendistro-for-elasticsearch/kibana-oss
ref: 7.7.0
token: ${{ secrets.KIBANA_OSS_ACCESS }}
path: kibana
- name: Get node and yarn versions
id: versions_step
run: |
echo "::set-output name=node_version::$(node -p "(require('./kibana/package.json').engines.node).match(/[.0-9]+/)[0]")"
echo "::set-output name=yarn_version::$(node -p "(require('./kibana/package.json').engines.yarn).match(/[.0-9]+/)[0]")"
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ steps.versions_step.outputs.node_version }}
registry-url: 'https://registry.npmjs.org'
- name: Install correct yarn version for Kibana
run: |
npm uninstall -g yarn
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
- name: Checkout Anomaly Detection Kibana plugin
uses: actions/checkout@v2
with:
path: kibana/plugins/anomaly-detection-kibana-plugin
- name: Bootstrap the plugin
run: |
cd kibana/plugins/anomaly-detection-kibana-plugin
yarn kbn bootstrap
- name: Run e2e tests
uses: cypress-io/github-action@v1
with:
working-directory: kibana/plugins/anomaly-detection-kibana-plugin
command: yarn test:e2e
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"start-cy-server": "yarn start --no-base-path --oss",
"cy:open": "cypress open",
"cy:run": "cypress run",
"test:e2e": "WAIT_ON_TIMEOUT=900000 start-server-and-test 'yarn start-cy-server' http-get://localhost:5601/app/opendistro-anomaly-detection-kibana 'yarn cy:run'"
"test:e2e": "CHOKIDAR_USEPOLLING=1 CYPRESS_responseTimeout=180000 WAIT_ON_TIMEOUT=900000 start-server-and-test 'yarn start-cy-server' http-get://localhost:5601/app/opendistro-anomaly-detection-kibana 'echo sleeping to wait for server to get ready && sleep 180 && yarn cy:run'"
},
"lint-staged": {
"*.{ts,tsx,js,jsx,json,css,md}": [
Expand Down

0 comments on commit beb8f89

Please sign in to comment.