1
- # Running AD integ tests stored in https://github.com/opensearch-project/opensearch-dashboards-functional-test
2
- # In the future we should pull dependencies from bundled build snapshots. Because that is not available
3
- # yet we build the cluster from source (besides core Opensearch, which is a pulled min artifact).
4
- name : Remote integ tests workflow
5
- on :
6
- push :
7
- branches :
8
- - " *"
9
- pull_request :
10
- branches :
11
- - " *"
1
+ name : FTR E2E AD Workbench Test
2
+
3
+ on : [pull_request, push]
4
+
5
+ env :
6
+ CI : 1
7
+ # avoid warnings like "tput: No value for $TERM and no -T specified"
8
+ TERM : xterm
9
+ OPENSEARCH_DASHBOARDS_VERSION : ' main'
10
+ OPENSEARCH_VERSION : ' 3.0.0'
11
+ OPENSEARCH_PLUGIN_VERSION : ' 3.0.0.0'
12
+
12
13
jobs :
13
- test-without-security :
14
- name : Run integ tests without security
14
+ tests :
15
+ name : Run FTR E2E AD Workbench Tests
15
16
strategy :
17
+ fail-fast : false
16
18
matrix :
17
- os : [ubuntu-latest, windows-latest]
18
- java : [11]
19
- include :
20
- - os : windows-latest
21
- cypress_cache_folder : ~/AppData/Local/Cypress/Cache
22
- - os : ubuntu-latest
23
- cypress_cache_folder : ~/.cache/Cypress
19
+ os : [ ubuntu-latest ]
20
+ jdk : [ 11 ]
24
21
runs-on : ${{ matrix.os }}
25
- steps :
26
- - name : Set up Java 11
27
- uses : actions/setup-java@v3
28
- with :
29
- distribution : ' corretto'
30
- java-version : ' 11'
31
-
32
- - name : Enable longer filenames
33
- if : ${{ matrix.os == 'windows-latest' }}
34
- run : git config --system core.longpaths true
35
-
36
- - name : Checkout OpenSearch Dashboards
37
- uses : actions/checkout@v2
38
- with :
39
- repository : opensearch-project/OpenSearch-Dashboards
40
- ref : ' ${{ github.base_ref }}'
41
- path : OpenSearch-Dashboards
42
-
43
- - name : Checkout Anomaly Detection OpenSearch Dashboards plugin
44
- uses : actions/checkout@v2
45
- with :
46
- path : OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin
47
22
48
- - name : Setup Node
49
- uses : actions/setup-node@v3
23
+ steps :
24
+ - name : Set up JDK
25
+ uses : actions/setup-java@v1
50
26
with :
51
- node-version-file : ' ./OpenSearch-Dashboards/.nvmrc'
52
- registry-url : ' https://registry.npmjs.org'
53
-
54
- - name : Install Yarn
55
- # Need to use bash to avoid having a windows/linux specific step
56
- shell : bash
57
- run : |
58
- YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn")
59
- echo "Installing yarn@$YARN_VERSION"
60
- npm i -g yarn@$YARN_VERSION
61
-
62
- - run : node -v
63
- - run : yarn -v
27
+ java-version : ${{ matrix.jdk }}
64
28
65
29
- name : Checkout Anomaly-Detection
66
30
uses : actions/checkout@v2
@@ -72,62 +36,114 @@ jobs:
72
36
- name : Run OpenSearch with plugin
73
37
run : |
74
38
cd anomaly-detection
75
- CONFIG_PATH=../OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin/opensearch_dashboards.json
76
- OPENSEARCH_VERSION=$(node -p "require('$CONFIG_PATH').opensearchDashboardsVersion")-SNAPSHOT
77
- echo "Using OpenSearch version $OPENSEARCH_VERSION"
78
- ./gradlew run -Dopensearch.version=$OPENSEARCH_VERSION &
39
+ ./gradlew run &
79
40
timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9200)" != "200" ]]; do sleep 5; done'
80
41
shell : bash
42
+
43
+ - name : Check OpenSearch Running on Linux
44
+ if : ${{ runner.os != 'Windows'}}
45
+ run : curl http://localhost:9200/
46
+ shell : bash
47
+
48
+ - name : Show OpenSearch Logs
49
+ if : always()
50
+ run : cat ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/logs/opensearch.log
51
+ shell : bash
52
+
53
+ - name : Checkout OpenSearch Dashboards
54
+ uses : actions/checkout@v2
55
+ with :
56
+ path : OpenSearch-Dashboards
57
+ repository : opensearch-project/OpenSearch-Dashboards
58
+ ref : ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
59
+ fetch-depth : 0
60
+ filter : |
61
+ cypress
62
+ test
81
63
82
- - name : Bootstrap the plugin
83
- run : |
84
- cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin
85
- yarn osd bootstrap --single-version=loose
64
+ - name : Checkout AD in OpenSearch Dashboards Plugins Dir
65
+ uses : actions/checkout@v2
66
+ with :
67
+ path : OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin
86
68
87
- - name : Run OpenSearch Dashboards server
69
+ - id : tool-versions
88
70
run : |
89
- cd OpenSearch-Dashboards
90
- yarn start --no-base-path --no-watch &
71
+ echo "node_version=$(cat .node-version)" >> $GITHUB_OUTPUT
72
+ echo "yarn_version=$(jq -r '.engines.yarn' package.json)" >> $GITHUB_OUTPUT
73
+ working-directory : OpenSearch-Dashboards
91
74
shell : bash
92
75
93
- # Window is slow so wait longer
94
- - name : Sleep until OSD server starts - windows
95
- if : ${{ matrix.os == 'windows-latest' }}
96
- run : Start-Sleep -s 400
97
- shell : powershell
76
+ - uses : actions/setup-node@v1
77
+ with :
78
+ node-version : ${{ steps.tool-versions.outputs.node_version }}
79
+ registry-url : ' https://registry.npmjs.org'
98
80
99
- - name : Sleep until OSD server starts - non-windows
100
- if : ${{ matrix.os != 'windows-latest' }}
101
- run : sleep 300
81
+ - name : Setup Opensearch Dashboards
82
+ run : |
83
+ npm uninstall -g yarn
84
+ echo "Installing yarn ${{ steps.tool-versions.outputs.yarn_version }}"
85
+ npm i -g yarn@${{ steps.tool-versions.outputs.yarn_version }}
86
+ yarn cache clean
87
+ yarn add sha.js
88
+ working-directory : OpenSearch-Dashboards
102
89
shell : bash
103
90
104
- - name : Checkout opensearch-dashboards-functional-test
91
+ - name : Boodstrap Opensearch Dashboards
92
+ run : |
93
+ yarn osd bootstrap --single-version=loose
94
+ working-directory : OpenSearch-Dashboards
95
+
96
+ - name : Run Opensearch Dashboards with Query Workbench Installed
97
+ run : |
98
+ nohup yarn start --no-base-path --no-watch | tee dashboard.log &
99
+ working-directory : OpenSearch-Dashboards
100
+
101
+ - name : Check If OpenSearch Dashboards Is Ready
102
+ if : ${{ runner.os == 'Linux' }}
103
+ run : |
104
+ if timeout 600 grep -q "bundles compiled successfully after" <(tail -n0 -f dashboard.log); then
105
+ echo "OpenSearch Dashboards compiled successfully."
106
+ else
107
+ echo "Timeout for 600 seconds reached. OpenSearch Dashboards did not finish compiling."
108
+ exit 1
109
+ fi
110
+ working-directory : OpenSearch-Dashboards
111
+
112
+ - name : Checkout Dashboards Functioanl Test Repo
105
113
uses : actions/checkout@v2
106
114
with :
107
115
path : opensearch-dashboards-functional-test
108
116
repository : opensearch-project/opensearch-dashboards-functional-test
109
- ref : ' ${{ github.base_ref }}'
117
+ ref : ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
118
+ fetch-depth : 0
119
+
120
+ - name : Install Cypress
121
+ run : |
122
+ npm install cypress --save-dev
123
+ shell : bash
124
+ working-directory : opensearch-dashboards-functional-test
110
125
111
126
- name : Get Cypress version
112
127
id : cypress_version
113
128
run : |
114
- echo "::set-output name=cypress_version::$(cat ./opensearch-dashboards-functional-test/package.json | jq '.devDependencies.cypress' | tr -d '"')"
129
+ echo "::set-output name=cypress_version::$(cat ./package.json | jq '.dependencies.cypress' | tr -d '"')"
130
+ working-directory : opensearch-dashboards-functional-test
115
131
116
- - name : Cache Cypress
117
- id : cache-cypress
118
- uses : actions/cache@v1
132
+ - name : Run Cypress tests
133
+ run : |
134
+ yarn cypress:run-without-security --browser chromium --spec 'cypress/integration/plugins/anomaly-detection-dashboards-plugin/*.js'
135
+ working-directory : opensearch-dashboards-functional-test
136
+
137
+ - name : Capture failure screenshots
138
+ uses : actions/upload-artifact@v1
139
+ if : failure()
119
140
with :
120
- path : ${{ matrix.cypress_cache_folder }}
121
- key : cypress-cache-v2-${{ runner.os }}-${{ hashFiles('**/package.json') }}
122
- env :
123
- CYPRESS_INSTALL_BINARY : ${{ steps.cypress_version.outputs.cypress_version }}
124
- - run : npx cypress cache list
125
- - run : npx cypress cache path
126
-
127
- - name : Run AD cypress tests
128
- uses : cypress-io/github-action@v2
141
+ name : cypress-screenshots-${{ matrix.os }}
142
+ path : opensearch-dashboards-functional-test/cypress/screenshots
143
+
144
+ - name : Capture failure test video
145
+ uses : actions/upload-artifact@v1
146
+ if : failure()
129
147
with :
130
- working-directory : opensearch-dashboards-functional-test
131
- command : yarn run cypress run --env SECURITY_ENABLED=false --spec cypress/integration/plugins/anomaly-detection-dashboards-plugin/**/*.js
132
- env :
133
- CYPRESS_CACHE_FOLDER : ${{ matrix.cypress_cache_folder }}
148
+ name : cypress-videos-${{ matrix.os }}
149
+ path : opensearch-dashboards-functional-test/cypress/videos
0 commit comments