-
Notifications
You must be signed in to change notification settings - Fork 0
203 lines (168 loc) · 8.43 KB
/
test-pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: Java Test CI with Gradle
on:
push:
# only trigger on branches, not on tags
branches: '**'
jobs:
unit-test:
name: Unit Test Kangooroo Source Code
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.4.2
- run: gradle test
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
if: always()
with:
name: test-result
path: build/reports/tests/
retention-days: 5
no-proxy-integration-test:
name: Integration Test Kangooroo without Proxy
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.4.2
- run: gradle distZip
- uses: browser-actions/setup-chrome@v1
- uses: nanasess/setup-chromedriver@v2
- name: Get all files ready to run Kangooroo
run: cp /usr/local/bin/chromedriver . && mkdir output && mkdir tmp && cp build/distributions/KangoorooStandalone.zip .
- name: Install Kangooroo Java
run: unzip -j KangoorooStandalone.zip KangoorooStandalone/lib/* -d lib && unzip -j KangoorooStandalone.zip KangoorooStandalone/bin/* -d bin
- name: Run Kangooroo with default settings
run: ./bin/kangooroo -mods summary --url https://duckduckgo.com/
- name: Check all output files of Kangooroo is present
run: |
ls --format=commas output/168ce875a2188cce97924a11f6a918df/ > output1.txt
cmp --silent test/integration_test/assert_output_files.txt output1.txt && echo "All expected output files are present." || exit 1
- name: Check if tmp folder is empty
run: ls -l tmp | grep -q "total 0" || exit 1
- name: Check if result.json have expected keys
run: |
grep -qe "response_code" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "connection_success" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "requestedUrl" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "actualUrl" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "has_timed_out" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "processTime" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "startTime" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineName" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineVersion" output/168ce875a2188cce97924a11f6a918df/results.json || exit 1
with-proxy-integration-test:
name: Integration Test Kangooroo with Proxy
runs-on: ubuntu-latest
services:
proxypy:
image: abhinavsingh/proxy.py
ports:
- 8899:8899
steps:
- uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.4.2
- run: gradle distZip
- uses: browser-actions/setup-chrome@v1
- uses: nanasess/setup-chromedriver@v2
- name: Get all files ready to run Kangooroo
run: cp /usr/local/bin/chromedriver . && mkdir output2 && mkdir tmp && cp build/distributions/KangoorooStandalone.zip .
- name: Install Kangooroo Java
run: unzip -j KangoorooStandalone.zip KangoorooStandalone/lib/* -d lib && unzip -j KangoorooStandalone.zip KangoorooStandalone/bin/* -d bin
- name: Run Kangooroo with Proxy
run: ./bin/kangooroo -cf test/integration_test/test_conf.yml -mods summary --url https://duckduckgo.com/
- name: Check all output files of Kangooroo is present
run: |
ls --format=commas output2/168ce875a2188cce97924a11f6a918df/ > output2.txt
cmp --silent test/integration_test/assert_output_files.txt output2.txt && echo "All expected output files are present." || exit 1
- name: Check if kangooroo connected to the proxy
run: |
sleep 10
docker logs "${{ job.services.proxypy.id }}" >& output3.txt
grep -qe "duckduckgo.com:443" output3.txt
- name: Check if tmp folder is empty
run: ls -l tmp | grep -q "total 0" || exit 1
- name: Check if result.json have expected keys
run: |
grep -qe "response_code" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "connection_success" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "requestedUrl" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "actualUrl" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "has_timed_out" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "processTime" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "startTime" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineName" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineVersion" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
with-proxy-sandbox-integration-test:
name: Integration Test Kangooroo with Proxy
runs-on: ubuntu-latest
services:
proxypy:
image: abhinavsingh/proxy.py
ports:
- 8899:8899
steps:
- uses: actions/[email protected]
- name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.4.2
- run: gradle distZip
- uses: browser-actions/setup-chrome@v1
- uses: nanasess/setup-chromedriver@v2
- name: Get all files ready to run Kangooroo
run: cp /usr/local/bin/chromedriver . && mkdir output2 && mkdir tmp && cp build/distributions/KangoorooStandalone.zip .
- name: Install Kangooroo Java
run: unzip -j KangoorooStandalone.zip KangoorooStandalone/lib/* -d lib && unzip -j KangoorooStandalone.zip KangoorooStandalone/bin/* -d bin
- name: Run Kangooroo with Proxy and Sandbox
run: ./bin/kangooroo -mods summary --no-sandbox -cf test/integration_test/test_conf.yml --url https://duckduckgo.com/
- name: Check all output files of Kangooroo is present
run: |
ls --format=commas output2/168ce875a2188cce97924a11f6a918df/ > output2.txt
cmp --silent test/integration_test/assert_output_files.txt output2.txt && echo "All expected output files are present." || exit 1
- name: Check if kangooroo connected to the proxy
run: |
sleep 10
docker logs "${{ job.services.proxypy.id }}" >& output3.txt
grep -qe "duckduckgo.com:443" output3.txt
- name: Check if tmp folder is empty
run: ls -l tmp | grep -q "total 0" || exit 1
- name: Check if result.json have expected keys
run: |
grep -qe "response_code" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "connection_success" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "requestedUrl" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "actualUrl" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "has_timed_out" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "processTime" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "startTime" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineName" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1
grep -qe "engineVersion" output2/168ce875a2188cce97924a11f6a918df/results.json || exit 1