Skip to content

Commit 612d24b

Browse files
TheCamNelsonNelson WangcameronnTheCamNelsonnwang92
authored
Rewrite tests to add parallelization (#402)
* Initial commit * initial commit * added more tests * fix todo * added more tests * changed makefile to run new tests * added tests; removed some container names; working * remove unnecessary functions and container names * add env variables for tests to avoid timeout * fix broken test * add parallelism * fix failing tests * fix spelling error * adding another thread for tests * fix flaky test * add missing tests * seperate tests by size * rewrite circleci architecture * revert architecture changes * add rerun to help mitigate flaky tests * seperate tests into single and distributed * add missing tests * add removal of default.yml * Fixing non-terminating loop, more structured OOP * remove duplicate functions * remove check_for_default * remove tar conflicts * remove test_docker_splunk Co-authored-by: Nelson Wang <[email protected]> Co-authored-by: cameronn <[email protected]> Co-authored-by: TheCamNelson <[email protected]> Co-authored-by: Nelson Wang <[email protected]>
1 parent c641c9a commit 612d24b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3069
-3110
lines changed

.circleci/config.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@ jobs:
6161
name: Test if image size increase
6262
command: make test_debian10_image_size
6363
- run:
64-
name: Run Debian 10 image tests
65-
command: make run_tests_debian10
64+
name: Run small Debian 10 image tests
65+
command: make run_small_tests_debian10
66+
no_output_timeout: 20m
67+
- run:
68+
name: Run large Debian 10 image tests
69+
command: make run_large_tests_debian10
6670
no_output_timeout: 20m
6771
- store_artifacts:
6872
path: test-results
@@ -95,8 +99,12 @@ jobs:
9599
command: |
96100
make uf-redhat-8
97101
- run:
98-
name: Run Redhat 8 image tests
99-
command: make run_tests_redhat8
102+
name: Run small Redhat 8 image tests
103+
command: make run_small_tests_redhat8
104+
no_output_timeout: 20m
105+
- run:
106+
name: Run large Redhat 8 image tests
107+
command: make run_large_tests_redhat8
100108
no_output_timeout: 20m
101109
- store_artifacts:
102110
path: test-results
@@ -144,6 +152,4 @@ workflows:
144152
- security-scanning
145153
- debian10-testing
146154
- container-validation
147-
- redhat8-testing
148-
149-
155+
- redhat8-testing

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ splunk-ansible
88
*.xml
99
*clair-scanner*
1010
.env
11-
tests/fixtures/*
1211
venv

Makefile

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -289,23 +289,35 @@ sample-compose-up: sample-compose-down
289289
sample-compose-down:
290290
docker-compose -f test_scenarios/${SPLUNK_COMPOSE} down --volumes --remove-orphans || true
291291

292-
test: clean ansible test_setup all run_tests_centos7 run_tests_redhat8 run_tests_debian9
292+
test: clean ansible test_setup all run_small_tests run_large_tests
293293

294-
test_centos7: clean ansible splunk-centos-7 uf-centos-7 test_setup run_tests_centos7
294+
run_small_tests: run_small_tests_centos7 run_small_tests_redhat8 run_small_tests_debian9 run_small_tests_debian10
295295

296-
test_redhat8: clean ansible splunk-redhat-8 uf-redhat-8 test_setup run_tests_redhat8
296+
run_large_tests: run_large_tests_centos7 run_large_tests_redhat8 run_large_tests_debian9 run_large_tests_debian10
297297

298-
test_debian9: clean ansible splunk-debian-9 uf-debian-9 test_setup run_tests_debian9
298+
test_centos7: clean ansible splunk-centos-7 uf-centos-7 test_setup run_small_tests_centos7 run_large_tests_centos7
299299

300-
test_debian10: clean ansible splunk-debian-10 uf-debian-10 test_setup run_tests_debian10
300+
test_redhat8: clean ansible splunk-redhat-8 uf-redhat-8 test_setup run_small_tests_redhat8 run_large_tests_redhat8
301301

302-
run_tests_centos7:
303-
@echo 'Running the super awesome tests; CentOS 7'
304-
pytest -sv tests/test_docker_splunk.py --platform centos-7 --junitxml test-results/centos7-result/testresults_centos7.xml
302+
test_debian9: clean ansible splunk-debian-9 uf-debian-9 test_setup run_small_tests_debian9 run_large_tests_debian9
305303

306-
run_tests_redhat8:
307-
@echo 'Running the super awesome tests; RedHat 8'
308-
pytest -sv tests/test_docker_splunk.py --platform redhat-8 --junitxml test-results/redhat8-result/testresults_redhat8.xml
304+
test_debian10: clean ansible splunk-debian-10 uf-debian-10 test_setup run_small_tests_debian10 run_large_tests_debian10
305+
306+
run_small_tests_centos7:
307+
@echo 'Running the super awesome small tests; CentOS 7'
308+
pytest -n 3 --reruns 1 -sv tests/test_single_splunk_image.py --platform centos-7 --junitxml test-results/centos7-result/testresults_small_centos7.xml
309+
310+
run_large_tests_centos7:
311+
@echo 'Running the super awesome large tests; CentOS 7'
312+
pytest -n 2 --reruns 1 -sv tests/test_distributed_splunk_image.py --platform centos-7 --junitxml test-results/centos7-result/testresults_large_centos7.xml
313+
314+
run_small_tests_redhat8:
315+
@echo 'Running the super awesome small tests; RedHat 8'
316+
pytest -n 3 --reruns 1 -sv tests/test_single_splunk_image.py --platform redhat-8 --junitxml test-results/redhat8-result/testresults_small_redhat8.xml
317+
318+
run_large_tests_redhat8:
319+
@echo 'Running the super awesome large tests; RedHat 8'
320+
pytest -n 2 --reruns 1 -sv tests/test_distributed_splunk_image.py --platform redhat-8 --junitxml test-results/redhat8-result/testresults_large_redhat8.xml
309321

310322
test_setup:
311323
@echo 'Install test requirements'
@@ -316,13 +328,21 @@ test_setup:
316328
mkdir test-results/debian10-result || true
317329
mkdir test-results/redhat8-result || true
318330

319-
run_tests_debian9:
320-
@echo 'Running the super awesome tests; Debian 9'
321-
pytest -sv tests/test_docker_splunk.py --platform debian-9 --junitxml test-results/debian9-result/testresults_debian9.xml
331+
run_small_tests_debian9:
332+
@echo 'Running the super awesome small tests; Debian 9'
333+
pytest -n 3 --reruns 1 -sv tests/test_single_splunk_image.py --platform debian-9 --junitxml test-results/debian9-result/testresults_small_debian9.xml
334+
335+
run_large_tests_debian9:
336+
@echo 'Running the super awesome large tests; Debian 9'
337+
pytest -n 2 --reruns 1 -sv tests/test_distributed_splunk_image.py --platform debian-9 --junitxml test-results/debian9-result/testresults_large_debian9.xml
338+
339+
run_small_tests_debian10:
340+
@echo 'Running the super awesome small tests; Debian 10'
341+
pytest -n 3 --reruns 1 -sv tests/test_single_splunk_image.py --platform debian-10 --junitxml test-results/debian10-result/testresults_small_debian10.xml
322342

323-
run_tests_debian10:
324-
@echo 'Running the super awesome tests; Debian 10'
325-
pytest -sv tests/test_docker_splunk.py --platform debian-10 --junitxml test-results/debian10-result/testresults_debian10.xml
343+
run_large_tests_debian10:
344+
@echo 'Running the super awesome large tests; Debian 10'
345+
pytest -n 2 --reruns 1 -sv tests/test_distributed_splunk_image.py --platform debian-10 --junitxml test-results/debian10-result/testresults_large_debian10.xml
326346

327347
save_containers:
328348
@echo 'Saving the following containers:${CONTAINERS_TO_SAVE}'

test_scenarios/1deployment1cm.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ services:
1313
- appserver
1414
image: nwang92/nginx-mitm
1515
hostname: appserver
16-
container_name: appserver
1716
ports:
1817
- 80
1918
volumes:
@@ -26,13 +25,13 @@ services:
2625
- depserver1
2726
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
2827
hostname: depserver1
29-
container_name: depserver1
3028
environment:
3129
- SPLUNK_START_ARGS=--accept-license
3230
- SPLUNK_ROLE=splunk_deployment_server
33-
- SPLUNK_APPS_URL=http://appserver/splunk_app_example.tgz
31+
- SPLUNK_APPS_URL
3432
- DEBUG=true
3533
- SPLUNK_PASSWORD
34+
- SPLUNK_DEFAULTS_URL
3635
ports:
3736
- 8089
3837
volumes:
@@ -45,14 +44,14 @@ services:
4544
- cm1
4645
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
4746
hostname: cm1
48-
container_name: cm1
4947
environment:
5048
- SPLUNK_START_ARGS=--accept-license
5149
- SPLUNK_DEPLOYMENT_SERVER=depserver1
5250
- SPLUNK_ROLE=splunk_cluster_master
5351
- SPLUNK_CLUSTER_MASTER_URL=cm1
5452
- DEBUG=true
5553
- SPLUNK_PASSWORD
54+
- SPLUNK_DEFAULTS_URL
5655
ports:
5756
- 8000
5857
- 8089

test_scenarios/1deployment1so.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ services:
1313
- appserver
1414
image: nwang92/nginx-mitm
1515
hostname: appserver
16-
container_name: appserver
1716
ports:
1817
- 80
1918
volumes:
@@ -26,11 +25,10 @@ services:
2625
- depserver1
2726
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
2827
hostname: depserver1
29-
container_name: depserver1
3028
environment:
3129
- SPLUNK_START_ARGS=--accept-license
3230
- SPLUNK_ROLE=splunk_deployment_server
33-
- SPLUNK_APPS_URL=http://appserver/splunk_app_example.tgz
31+
- SPLUNK_APPS_URL
3432
- DEBUG=true
3533
- SPLUNK_PASSWORD
3634
ports:
@@ -43,7 +41,6 @@ services:
4341
- so1
4442
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
4543
hostname: so1
46-
container_name: so1
4744
environment:
4845
- SPLUNK_START_ARGS=--accept-license
4946
- SPLUNK_DEPLOYMENT_SERVER=depserver1

test_scenarios/1deployment1uf.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ services:
1313
- appserver
1414
image: nwang92/nginx-mitm
1515
hostname: appserver
16-
container_name: appserver
1716
ports:
1817
- 80
1918
volumes:
@@ -26,11 +25,10 @@ services:
2625
- depserver1
2726
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
2827
hostname: depserver1
29-
container_name: depserver1
3028
environment:
3129
- SPLUNK_START_ARGS=--accept-license
3230
- SPLUNK_ROLE=splunk_deployment_server
33-
- SPLUNK_APPS_URL=http://appserver/splunk_app_example.tgz
31+
- SPLUNK_APPS_URL
3432
- DEBUG=true
3533
- SPLUNK_PASSWORD
3634
ports:
@@ -43,7 +41,6 @@ services:
4341
- uf1
4442
image: ${UF_IMAGE:-splunk/universalforwarder:latest}
4543
hostname: uf1
46-
container_name: uf1
4744
environment:
4845
- SPLUNK_START_ARGS=--accept-license
4946
- SPLUNK_DEPLOYMENT_SERVER=depserver1

test_scenarios/1hf_splunk_add_user.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ services:
1212
aliases:
1313
- hf1
1414
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
15-
container_name: hf1
1615
environment:
1716
- SPLUNK_ROLE=splunk_heavy_forwarder
1817
- SPLUNK_START_ARGS=--accept-license

test_scenarios/1idx3sh1cm1dep.yaml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ services:
1313
- appserver
1414
image: nwang92/nginx-mitm
1515
hostname: appserver
16-
container_name: appserver
1716
ports:
1817
- 80
1918
volumes:
@@ -26,7 +25,6 @@ services:
2625
- dep1
2726
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
2827
hostname: dep1
29-
container_name: dep1
3028
environment:
3129
- SPLUNK_START_ARGS=--accept-license
3230
- SPLUNK_INDEXER_URL=idx1
@@ -38,7 +36,8 @@ services:
3836
- SPLUNK_LICENSE_URI
3937
- DEBUG=true
4038
- SPLUNK_PASSWORD
41-
- SPLUNK_APPS_URL=http://appserver/splunk_app_example.tgz
39+
- SPLUNK_DEFAULTS_URL
40+
- SPLUNK_APPS_URL
4241
ports:
4342
- 8000
4443
- 8089
@@ -52,7 +51,6 @@ services:
5251
- sh1
5352
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
5453
hostname: sh1
55-
container_name: sh1
5654
environment:
5755
- SPLUNK_START_ARGS=--accept-license
5856
- SPLUNK_INDEXER_URL=idx1
@@ -64,6 +62,7 @@ services:
6462
- SPLUNK_LICENSE_URI
6563
- DEBUG=true
6664
- SPLUNK_PASSWORD
65+
- SPLUNK_DEFAULTS_URL
6766
ports:
6867
- 8000
6968
- 8089
@@ -77,7 +76,6 @@ services:
7776
- sh2
7877
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
7978
hostname: sh2
80-
container_name: sh2
8179
environment:
8280
- SPLUNK_START_ARGS=--accept-license
8381
- SPLUNK_INDEXER_URL=idx1
@@ -89,6 +87,7 @@ services:
8987
- SPLUNK_LICENSE_URI
9088
- DEBUG=true
9189
- SPLUNK_PASSWORD
90+
- SPLUNK_DEFAULTS_URL
9291
ports:
9392
- 8000
9493
- 8089
@@ -102,7 +101,6 @@ services:
102101
- sh3
103102
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
104103
hostname: sh3
105-
container_name: sh3
106104
environment:
107105
- SPLUNK_START_ARGS=--accept-license
108106
- SPLUNK_INDEXER_URL=idx1
@@ -114,6 +112,7 @@ services:
114112
- SPLUNK_LICENSE_URI
115113
- DEBUG=true
116114
- SPLUNK_PASSWORD
115+
- SPLUNK_DEFAULTS_URL
117116
ports:
118117
- 8000
119118
- 8089
@@ -127,7 +126,6 @@ services:
127126
- cm1
128127
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
129128
hostname: cm1
130-
container_name: cm1
131129
environment:
132130
- SPLUNK_START_ARGS=--accept-license
133131
- SPLUNK_INDEXER_URL=idx1
@@ -139,7 +137,8 @@ services:
139137
- SPLUNK_LICENSE_URI
140138
- DEBUG=true
141139
- SPLUNK_PASSWORD
142-
- SPLUNK_APPS_URL=http://appserver/splunk_app_example.tgz
140+
- SPLUNK_DEFAULTS_URL
141+
- SPLUNK_APPS_URL
143142
ports:
144143
- 8000
145144
- 8089
@@ -153,7 +152,6 @@ services:
153152
- idx1
154153
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
155154
hostname: idx1
156-
container_name: idx1
157155
environment:
158156
- SPLUNK_START_ARGS=--accept-license
159157
- SPLUNK_INDEXER_URL=idx1
@@ -162,10 +160,11 @@ services:
162160
- SPLUNK_DEPLOYER_URL=dep1
163161
- SPLUNK_CLUSTER_MASTER_URL=cm1
164162
- SPLUNK_ROLE=splunk_indexer
165-
- SPLUNK_APPS_URL=http://appserver/splunk_app_example.tgz
163+
- SPLUNK_APPS_URL
166164
- SPLUNK_LICENSE_URI
167165
- DEBUG=true
168166
- SPLUNK_PASSWORD
167+
- SPLUNK_DEFAULTS_URL
169168
ports:
170169
- 8000
171170
- 8089

test_scenarios/1sh1cm.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ services:
1313
- sh1
1414
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
1515
hostname: sh1
16-
container_name: sh1
1716
environment:
1817
- SPLUNK_START_ARGS=--accept-license
1918
- SPLUNK_CLUSTER_MASTER_URL=cm1
@@ -31,7 +30,6 @@ services:
3130
- cm1
3231
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
3332
hostname: cm1
34-
container_name: cm1
3533
environment:
3634
- SPLUNK_START_ARGS=--accept-license
3735
- SPLUNK_ROLE=splunk_cluster_master

test_scenarios/1sh1cm1dmc.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ services:
1313
- sh1
1414
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
1515
hostname: sh1
16-
container_name: sh1
1716
environment:
1817
- SPLUNK_START_ARGS=--accept-license
1918
- SPLUNK_CLUSTER_MASTER_URL=cm1
@@ -31,7 +30,6 @@ services:
3130
- cm1
3231
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
3332
hostname: cm1
34-
container_name: cm1
3533
environment:
3634
- SPLUNK_START_ARGS=--accept-license
3735
- SPLUNK_ROLE=splunk_cluster_master
@@ -49,7 +47,6 @@ services:
4947
image: ${SPLUNK_IMAGE:-splunk/splunk:latest}
5048
command: start
5149
hostname: dmc
52-
container_name: dmc
5350
environment:
5451
- SPLUNK_START_ARGS=--accept-license
5552
- SPLUNK_CLUSTER_MASTER_URL=cm1

0 commit comments

Comments
 (0)