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

Add CI for e2e #208

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Contributor

@ylwu-amzn ylwu-amzn Jun 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change, very helpful. The workflow looks good.

Is it possible to test with security plugin enabled? No need to answer or change this PR if no clear answer now. We can create issue and research later.

Asking this as start detector REST API will start AD job. We'd better test with security plugin enabled to know if AD job can run successfully, generate AD result and show the result correctly on Kibana.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. I created issue: #209

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