forked from OpenMined/PySyft
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtox.ini
More file actions
595 lines (517 loc) · 25.1 KB
/
tox.ini
File metadata and controls
595 lines (517 loc) · 25.1 KB
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
[tox]
envlist =
lint
grid.test.backend
grid.test.frontend
hagrid.publish
stack.test.course
stack.test.integration
stack.test.integration.k8s
stack.test.integration.smpc
stack.test.integration.tls
stack.test.integration.windows
syft.benchmark
syft.docs
syft.jupyter
syft.publish
hagrid.publish
syft.test.fast
syft.test.fast.coverage
syft.test.security
requires =
tox-run-command
pip >= 22.0.4
skipsdist = True
[testenv]
basepython = python3
deps = pip
commands =
python --version
[testenv:lint]
; setupdir = {toxinidir}
; changedir = {toxinidir}
description = Linting
allowlist_externals =
bash
deps =
black[python2]
isort
protoc-wheel-0
pre-commit
commands =
bash -c "cd {toxinidir}/packages/syft; ./scripts/build_proto.sh"
black .
isort .
pre-commit run --all-files
# Syft
[testenv:syft]
deps =
-e{toxinidir}/packages/syft[dev]
changedir = {toxinidir}/packages/syft
description = Syft
commands =
pip list
[testenv:syft.publish]
changedir = {toxinidir}/packages/syft
description = Build and Publish Syft Wheel
commands =
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel twine tox build
python -c 'from shutil import rmtree; rmtree("build", True); rmtree("dist", True)'
python -m build .
[testenv:hagrid.publish]
changedir = {toxinidir}/packages/hagrid
description = Build and Publish Hagrid Wheel
commands =
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel twine tox build
python -c 'from shutil import rmtree; rmtree("build", True); rmtree("dist", True)'
python -m build .
[testenv:syft.jupyter]
description = Jupyter Notebook with Editable Syft
deps =
{[testenv:syft]deps}
jupyter
jupyterlab
commands =
pip install -e packages/hagrid
pip install jupyter jupyterlab --upgrade
jupyter lab --ip 0.0.0.0 --ServerApp.token={posargs}
[testenv:syft.test.fast]
description = Syft Unit Tests Fast
deps =
{[testenv:syft]deps}
changedir = {toxinidir}/packages/syft
commands =
pip list
pytest -m fast -n auto
[testenv:syft.test.fast.coverage]
description = Syft Unit Tests Fast
deps =
{[testenv:syft]deps}
pytest-cov
changedir = {toxinidir}/packages/syft
commands =
pytest --cov=src -m fast -n auto
[testenv:syft.test.security]
description = Security Checks for Syft
changedir = {toxinidir}/packages/syft
deps =
{[testenv:syft]deps}
commands =
pip install --upgrade pip
bandit -r src
safety check
[testenv:syft.benchmark]
description = Benchmark for Syft
deps =
{[testenv:syft]deps}
changedir = {toxinidir}
allowlist_externals =
docker
grep
sleep
bash
setenv =
HAGRID_ART = false
PYTHONIOENCODING = utf-8
commands =
python --version
pip install --upgrade pip
pip install --upgrade pyperf
pip install -e packages/syft
pip install -e packages/hagrid
docker --version
docker compose version
bash -c 'HAGRID_ART=false hagrid launch test_domain_1 domain to docker:9082 --tag=local --tail=false --test'
docker ps
bash -c '(docker logs test_domain_1-backend_stream-1 -f &) | grep -q "Application startup complete" || true'
sleep 10
python benchmarks/macro_executor.py
python benchmarks/executor.py --fast -n 26 -o micro_benchmark.json
pyperf stats micro_benchmark.json
pyperf hist micro_benchmark.json
[testenv:syft.docs]
description = Build Docs for Syft
changedir = {toxinidir}/docs
deps = -r {toxinidir}/docs/requirements.txt
allowlist_externals =
make
echo
commands =
python --version
make html
echo "Open: {toxinidir}/docs/build/html/index.html"
[testenv:stack.test.integration]
description = Integration Tests for Core Stack
deps =
{[testenv:syft]deps}
changedir = {toxinidir}
allowlist_externals =
docker
grep
sleep
bash
setenv =
HAGRID_FLAGS = {env:HAGRID_FLAGS:--tag=local --test}
EMULATION = {env:EMULATION:false}
HAGRID_ART = false
PYTHONIOENCODING = utf-8
commands =
bash -c "echo Running with HAGRID_FLAGS=$HAGRID_FLAGS and EMULATION=$EMULATION"
bash -c 'if [[ "$HAGRID_FLAGS" == *"latest"* ]]; then \
pip install --pre --force pytest hagrid syft; \
else \
pip install -e packages/hagrid -e {toxinidir}/packages/syft[dev]; \
fi'
docker --version
docker compose version
bash -c "docker volume rm test_domain_1_app-db-data --force || true"
bash -c "docker volume rm test_domain_2_app-db-data --force || true"
bash -c "docker volume rm test_network_1_app-db-data --force || true"
bash -c "docker volume rm test_domain_1_app-redis-data --force || true"
bash -c "docker volume rm test_domain_2_app-redis-data --force || true"
bash -c "docker volume rm test_network_1_app-redis-data --force || true"
bash -c "docker volume rm test_domain_1_tailscale-data --force || true"
bash -c "docker volume rm test_domain_2_tailscale-data --force || true"
bash -c "docker volume rm test_network_1_tailscale-data --force || true"
bash -c "docker volume rm test_network_1_headscale-data --force || true"
bash -c 'HAGRID_ART=$HAGRID_ART NETWORK_CHECK_INTERVAL=5 hagrid launch test_network_1 network to docker:9081 --tail=false $HAGRID_FLAGS'
bash -c 'HAGRID_ART=$HAGRID_ART hagrid launch test_domain_1 domain to docker:9082 --tail=false $HAGRID_FLAGS'
bash -c 'HAGRID_ART=$HAGRID_ART hagrid launch test_domain_2 domain to docker:9083 --headless=true --tail=false $HAGRID_FLAGS'
docker ps
bash -c '(docker logs test_domain_1-frontend-1 -f &) | grep -q "event - compiled .* successfully\|nginx" || true'
bash -c '(docker logs test_domain_1-backend_stream-1 -f &) | grep -q "Application startup complete" || true'
bash -c '(docker logs test_domain_2-backend_stream-1 -f &) | grep -q "Application startup complete" || true'
bash -c '(docker logs test_network_1-backend_stream-1 -f &) | grep -q "Application startup complete" || true'
sleep 5
pytest tests/integration -m frontend -p no:randomly --co
pytest tests/integration -m frontend -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no
bash -c 'docker stop test_domain_1-frontend-1 || true'
pytest tests/integration -m network -p no:randomly --co
pytest tests/integration -m network -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no
pytest tests/integration -m e2e -p no:randomly --co
pytest tests/integration -m e2e -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no
pytest tests/integration -m security -p no:randomly --co
pytest tests/integration -m security -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no
bash -c 'HAGRID_ART=false hagrid land test_network_1'
bash -c 'HAGRID_ART=false hagrid land test_domain_1'
bash -c 'HAGRID_ART=false hagrid land test_domain_2'
[testenv:stack.test.integration.tls]
description = Integration Tests for Core Stack with TLS
deps =
{[testenv:syft]deps}
changedir = {toxinidir}
allowlist_externals =
docker
grep
sleep
bash
mkcert
mkdir
setenv =
HAGRID_ART = false
PYTHONIOENCODING = utf-8
IGNORE_TLS_ERRORS = True
CAROOT = {toxinidir}/packages/grid/tls
CERTS = {toxinidir}/packages/grid/traefik/certs
commands =
mkdir -p ./packages/grid/tls
bash -c "mkcert -cert-file={env:CERTS}/cert.pem -key-file={env:CERTS}/key.pem '*.openmined.grid' docker-host localhost 127.0.0.1 ::1"
; # mkcert -install # use this if you want to test in your own browser
pip install -e packages/hagrid
docker --version
docker compose version
bash -c "docker volume rm test_domain_1_app-db-data --force || true"
bash -c "docker volume rm test_domain_2_app-db-data --force || true"
bash -c "docker volume rm test_network_1_app-db-data --force || true"
bash -c "docker volume rm test_domain_1_app-redis-data --force || true"
bash -c "docker volume rm test_domain_2_app-redis-data --force || true"
bash -c "docker volume rm test_network_1_app-redis-data --force || true"
bash -c "docker volume rm test_domain_1_tailscale-data --force || true"
bash -c "docker volume rm test_domain_2_tailscale-data --force || true"
bash -c "docker volume rm test_network_1_tailscale-data --force || true"
bash -c "docker volume rm test_network_1_headscale-data --force || true"
bash -c "HAGRID_ART=false NETWORK_CHECK_INTERVAL=5 hagrid launch test_network_1 network to docker:9081 --tag=local --tail=false --tls --test --cert_store_path=./traefik/certs"
bash -c "HAGRID_ART=false hagrid launch test_domain_1 domain to docker:9082 --tag=local --tail=false --tls --test --cert_store_path=./traefik/certs"
bash -c "HAGRID_ART=false hagrid launch test_domain_2 domain to docker:9083 --tag=local --tail=false --headless=true --tls --test --cert_store_path=./traefik/certs"
docker ps
bash -c "(docker logs test_domain_1-frontend-1 -f &) | grep -q 'event - compiled .* successfully\|nginx' || true"
bash -c "(docker logs test_domain_1-backend_stream-1 -f &) | grep -q 'Application startup complete' || true"
bash -c "(docker logs test_domain_2-backend_stream-1 -f &) | grep -q 'Application startup complete' || true"
bash -c "(docker logs test_network_1-backend_stream-1 -f &) | grep -q 'Application startup complete' || true"
sleep 5
pytest tests/integration -m frontend -p no:randomly --co
bash -c "REQUESTS_CA_BUNDLE={env:CAROOT}/rootCA.pem pytest tests/integration -m frontend -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no"
bash -c "docker stop test_domain_1-frontend-1 || true"
pytest tests/integration -m network -p no:randomly --co
bash -c "REQUESTS_CA_BUNDLE={env:CAROOT}/rootCA.pem pytest tests/integration -m network -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no"
pytest tests/integration -m e2e -p no:randomly --co
bash -c "REQUESTS_CA_BUNDLE={env:CAROOT}/rootCA.pem pytest tests/integration -m e2e -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no"
pytest tests/integration -m security -p no:randomly --co
bash -c "REQUESTS_CA_BUNDLE={env:CAROOT}/rootCA.pem pytest tests/integration -m security -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no"
bash -c "HAGRID_ART=false hagrid land test_network_1"
bash -c "HAGRID_ART=false hagrid land test_domain_1"
bash -c "HAGRID_ART=false hagrid land test_domain_2"
[testenv:stack.test.integration.windows]
description = Integration Tests for Core Stack
changedir = {toxinidir}
allowlist_externals =
docker
bash
timeout
chcp
setenv =
HAGRID_ART = false
PYTHONIOENCODING = utf-8
commands =
chcp 65001
pip install jaxlib===0.3.7 -f https://whls.blob.core.windows.net/unstable/index.html
pip install -e packages/syft[dev]
; pip install -e packages/hagrid
docker --version
; hagrid launch test_network_1 network to docker:9081 --tag=local --tail=false --build=false --headless=true
; hagrid launch test_domain_1 domain to docker:9082 --tag=local --tail=false --build=false --headless=true
; hagrid launch test_domain_2 domain to docker:9083 --tag=local --tail=false --build=false --headless=true
; bash -c "(docker logs test_domain_1-frontend-1 -f &) | grep -q 'event - compiled .* successfully\|nginx' || true"
; bash -c "(docker logs test_domain_1-backend_stream-1 -f &) | grep -q 'Application startup complete' || true"
; bash -c "(docker logs test_domain_2-backend_stream-1 -f &) | grep -q 'Application startup complete' || true"
; bash -c "(docker logs test_network_1-backend_stream-1 -f &) | grep -q 'Application startup complete' || true"
; pytest tests/integration -m frontend -p no:randomly --co
; pytest tests/integration -m frontend -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no
; bash -c "docker stop test_domain_1-frontend-1 || true"
pytest tests/integration -m network -p no:randomly --co
pytest tests/integration -m network -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no
pytest tests/integration -m e2e -p no:randomly --co
pytest tests/integration -m e2e -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no
; pytest tests/integration -m security -p no:randomly --co
; pytest tests/integration -m security -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no
; hagrid land test_network_1
; hagrid land test_domain_1
; hagrid land test_domain_2
[testenv:stack.test.integration.smpc]
description = Integration Tests for Core Stack
deps =
{[testenv:syft]deps}
changedir = {toxinidir}
allowlist_externals =
docker
grep
sleep
bash
commands =
pip install -e packages/hagrid
docker --version
docker compose version
bash -c "docker volume rm test_domain_1_app-db-data --force || true"
bash -c "docker volume rm test_domain_2_app-db-data --force || true"
bash -c "docker volume rm test_domain_3_app-db-data --force || true"
bash -c "docker volume rm test_domain_1_app-redis-data --force || true"
bash -c "docker volume rm test_domain_2_app-redis-data --force || true"
bash -c "docker volume rm test_domain_3_app-redis-data --force || true"
bash -c "docker volume rm test_domain_1_tailscale-data --force || true"
bash -c "docker volume rm test_domain_2_tailscale-data --force || true"
bash -c "docker volume rm test_domain_3_tailscale-data --force || true"
bash -c 'HAGRID_ART=false hagrid launch test_domain_1 domain to docker:9082 --tag=local --tail=false --headless=true --test'
bash -c 'HAGRID_ART=false hagrid launch test_domain_2 domain to docker:9083 --tag=local --tail=false --headless=true --test'
bash -c 'HAGRID_ART=false hagrid launch test_domain_3 domain to docker:9084 --tag=local --tail=false --headless=true --test'
docker ps
bash -c '(docker logs test_domain_1-backend_stream-1 -f &) | grep -q "Application startup complete" || true'
bash -c '(docker logs test_domain_2-backend_stream-1 -f &) | grep -q "Application startup complete" || true'
bash -c '(docker logs test_domain_3-backend_stream-1 -f &) | grep -q "Application startup complete" || true'
sleep 5
; perform spmc test
pytest tests/integration -m smpc -p no:randomly --co
pytest tests/integration -m smpc -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no
bash -c 'HAGRID_ART=false hagrid land test_domain_1'
bash -c 'HAGRID_ART=false hagrid land test_domain_2'
bash -c 'HAGRID_ART=false hagrid land test_domain_3'
[testenv:stack.test.integration.k8s]
description = Integration Tests for Core Stack
deps =
{[testenv:syft]deps}
changedir = {toxinidir}
passenv=HOME
allowlist_externals =
devspace
kubectl
grep
sleep
bash
kubectx
k3d
echo
setenv =
CONTAINER_HOST = kubernetes
commands =
k3d version
bash -c "docker rm $(docker ps -aq) --force || true"
; bash -c "k3d cluster delete test-network-1 || true"
; bash -c "k3d cluster delete test-domain-1 || true"
; bash -c "k3d cluster delete test-domain-2 || true"
; bash -c "k3d registry delete k3d-registry.localhost || true"
; bash -c "docker volume rm k3d-test-network-1-images --force || true"
; bash -c "docker volume rm k3d-test-domain-1-images --force || true"
; bash -c "docker volume rm k3d-test-domain-2-images --force || true"
bash -c 'k3d registry create registry.localhost --port 12345 || true'
bash -c 'NODE_NAME=test-network-1 NODE_PORT=9081 && \
k3d cluster create $NODE_NAME -p "$NODE_PORT:80@loadbalancer" --registry-use k3d-registry.localhost || true \
k3d cluster start $NODE_NAME'
bash -c 'NODE_NAME=test-network-1 NODE_PORT=9081 && \
cd packages/grid && \
devspace --no-warn --kube-context "k3d-$NODE_NAME" --namespace $NODE_NAME \
--var DOMAIN_NAME=$NODE_NAME \
--var NETWORK_CHECK_INTERVAL=5 \
--var CONTAINER_REGISTRY=k3d-registry.localhost:12345/ \
build -b'
bash -c 'NODE_NAME=test-network-1 NODE_PORT=9081 && \
cd packages/grid && \
devspace --no-warn --kube-context "k3d-$NODE_NAME" --namespace $NODE_NAME \
--var DOMAIN_NAME=$NODE_NAME \
--var NETWORK_CHECK_INTERVAL=5 \
--var CONTAINER_REGISTRY=k3d-registry.localhost:12345/ \
deploy -b -p network'
bash -c 'NODE_NAME=test-domain-1 NODE_PORT=9082 && \
k3d cluster create $NODE_NAME -p "$NODE_PORT:80@loadbalancer" --registry-use k3d-registry.localhost || true \
k3d cluster start $NODE_NAME'
bash -c 'NODE_NAME=test-domain-1 NODE_PORT=9082 && \
cd packages/grid && \
devspace --no-warn --kube-context "k3d-$NODE_NAME" --namespace $NODE_NAME \
--var DOMAIN_NAME=$NODE_NAME \
--var NETWORK_CHECK_INTERVAL=5 \
--var CONTAINER_REGISTRY=k3d-registry.localhost:12345/ \
deploy -b -p domain'
bash -c 'NODE_NAME=test-domain-2 NODE_PORT=9083 && \
k3d cluster create $NODE_NAME -p "$NODE_PORT:80@loadbalancer" --registry-use k3d-registry.localhost || true \
k3d cluster start $NODE_NAME'
bash -c 'NODE_NAME=test-domain-2 NODE_PORT=9083 && \
cd packages/grid && \
devspace --no-warn --kube-context "k3d-$NODE_NAME" --namespace $NODE_NAME \
--var DOMAIN_NAME=$NODE_NAME \
--var NETWORK_CHECK_INTERVAL=5 \
--var CONTAINER_REGISTRY=k3d-registry.localhost:12345/ \
deploy -b -p domain'
sleep 10
; wait for front end
bash packages/grid/scripts/wait_for.sh service frontend --context k3d-test-domain-1 --namespace test-domain-1
bash -c '(kubectl logs deployment.apps/frontend --context k3d-test-domain-1 --namespace test-domain-1 -f &) | grep -q "event - compiled .* successfully\|nginx" || true'
; wait for everything else to be loaded
bash packages/grid/scripts/wait_for.sh service tailscale --context k3d-test-network-1 --namespace test-network-1
bash packages/grid/scripts/wait_for.sh service queue --context k3d-test-network-1 --namespace test-network-1
bash packages/grid/scripts/wait_for.sh service redis --context k3d-test-network-1 --namespace test-network-1
bash packages/grid/scripts/wait_for.sh service db --context k3d-test-network-1 --namespace test-network-1
bash packages/grid/scripts/wait_for.sh service backend --context k3d-test-network-1 --namespace test-network-1
bash packages/grid/scripts/wait_for.sh service backend-stream --context k3d-test-network-1 --namespace test-network-1
bash packages/grid/scripts/wait_for.sh service headscale --context k3d-test-network-1 --namespace test-network-1
bash packages/grid/scripts/wait_for.sh service frontend --context k3d-test-domain-1 --namespace test-domain-1
bash packages/grid/scripts/wait_for.sh service tailscale --context k3d-test-domain-1 --namespace test-domain-1
bash packages/grid/scripts/wait_for.sh service queue --context k3d-test-domain-1 --namespace test-domain-1
bash packages/grid/scripts/wait_for.sh service redis --context k3d-test-domain-1 --namespace test-domain-1
bash packages/grid/scripts/wait_for.sh service db --context k3d-test-domain-1 --namespace test-domain-1
bash packages/grid/scripts/wait_for.sh service backend --context k3d-test-domain-1 --namespace test-domain-1
bash packages/grid/scripts/wait_for.sh service backend-stream --context k3d-test-domain-1 --namespace test-domain-1
bash packages/grid/scripts/wait_for.sh service seaweedfs --context k3d-test-domain-1 --namespace test-domain-1
bash packages/grid/scripts/wait_for.sh service frontend --context k3d-test-domain-2 --namespace test-domain-2
bash packages/grid/scripts/wait_for.sh service tailscale --context k3d-test-domain-2 --namespace test-domain-2
bash packages/grid/scripts/wait_for.sh service queue --context k3d-test-domain-2 --namespace test-domain-2
bash packages/grid/scripts/wait_for.sh service redis --context k3d-test-domain-2 --namespace test-domain-2
bash packages/grid/scripts/wait_for.sh service db --context k3d-test-domain-2 --namespace test-domain-2
bash packages/grid/scripts/wait_for.sh service backend --context k3d-test-domain-2 --namespace test-domain-2
bash packages/grid/scripts/wait_for.sh service backend-stream --context k3d-test-domain-2 --namespace test-domain-2
bash packages/grid/scripts/wait_for.sh service seaweedfs --context k3d-test-domain-2 --namespace test-domain-2
pytest tests/integration -m frontend -p no:randomly --co
bash -c "CONTAINER_HOST=$CONTAINER_HOST pytest tests/integration -m frontend -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no"
bash -c '(kubectl logs deployment.apps/backend-stream --context k3d-test-network-1 --namespace test-network-1 -f &) | grep -q "Application startup complete" || true'
bash -c '(kubectl logs deployment.apps/backend-stream --context k3d-test-domain-1 --namespace test-domain-1 -f &) | grep -q "Application startup complete" || true'
bash -c '(kubectl logs deployment.apps/backend-stream --context k3d-test-domain-2 --namespace test-domain-2 -f &) | grep -q "Application startup complete" || true'
pytest tests/integration -m network -p no:randomly --co
bash -c "CONTAINER_HOST=$CONTAINER_HOST pytest tests/integration -m network -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no"
pytest tests/integration -m e2e -p no:randomly --co
bash -c "CONTAINER_HOST=$CONTAINER_HOST pytest tests/integration -m e2e -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no"
pytest tests/integration -m security -p no:randomly --co
bash -c "CONTAINER_HOST=$CONTAINER_HOST pytest tests/integration -m security -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no"
; bash -c "k3d cluster delete test-network-1 || true"
; bash -c "k3d cluster delete test-domain-1 || true"
; bash -c "k3d cluster delete test-domain-2 || true"
; bash -c "k3d registry delete k3d-registry.localhost || true"
bash -c "docker rm $(docker ps -aq) --force || true"
bash -c "docker volume rm k3d-test-network-1-images --force || true"
bash -c "docker volume rm k3d-test-domain-1-images --force || true"
bash -c "docker volume rm k3d-test-domain-2-images --force || true"
[testenv:stack.test.course]
description = Integration Tests for Course Notebooks
deps =
{[testenv:syft]deps}
changedir = {toxinidir}
allowlist_externals =
docker
grep
sleep
bash
commands =
pip install -e packages/hagrid
pip install testbook prompt-toolkit jupyter
docker --version
docker compose version
bash -c "docker volume rm test_domain_1_app-db-data --force || true"
bash -c "docker volume rm test_domain_1_app-redis-data --force || true"
bash -c "docker volume rm test_domain_1_tailscale-data --force || true"
bash -c 'HAGRID_ART=false hagrid launch test_domain_1 domain to docker:8081 --tag=local --tail=false --headless=true --test'
bash -c 'git clone https://github.com/OpenMined/courses.git tests/course/courses/ || true'
bash -c 'cd tests/course/courses && git fetch && git checkout introduction-to-remote-data-science-dev && git pull || true'
bash -c 'cp -r tests/course/tests/ tests/course/courses/'
docker ps
bash -c '(docker logs test_domain_1-backend_stream-1 -f &) | grep -q "Application startup complete" || true'
; perform course notebook test
bash -c 'cd tests/course/courses && pytest -p no:randomly -vvvv'
bash -c 'HAGRID_ART=false hagrid land test_domain_1'
bash -c 'rm -rf tests/course/courses'
[testenv:grid.test.backend]
description = Tests for Grid Backend
deps =
{[testenv:syft]deps}
-r {toxinidir}/packages/grid/backend/requirements.txt
-r {toxinidir}/packages/grid/backend/requirements.dev.txt
changedir = {toxinidir}/packages/grid/backend
allowlist_externals =
bash
commands =
python --version
bash -c 'USE_NEW_SERVICE=False SQLALCHEMY_DATABASE_URI="sqlite:///file:test_db?mode=memory&cache=shared&uri=true" LOGURU_SINK="./grid.log" pytest grid/tests'
# Test New Service
bash -c 'USE_NEW_SERVICE=True SQLALCHEMY_DATABASE_URI="sqlite:///file:test_db?mode=memory&cache=shared&uri=true" LOGURU_SINK="./grid.log" pytest grid/tests/api/users/user_routes_test.py'
[testenv:grid.test.frontend]
description = Tests for Grid Frontend
deps =
changedir = {toxinidir}/packages/grid/frontend
allowlist_externals =
bash
echo
yarn
docker
commands =
; check yarn is installed
bash ./scripts/check_yarn.sh
; install hagrid
pip install -e {toxinidir}/packages/hagrid
; launch a domain
bash -c "docker volume rm test_domain_1_app-db-data --force || true"
bash -c "docker volume rm test_domain_1_tailscale-data --force || true"
bash -c 'HAGRID_ART=false hagrid launch test_domain_1 domain to docker:9082 --tag=local --build=false --tail=false --test'
docker ps
; install packages
yarn install
; wait for server to be up
bash -c '(docker logs test_domain_1-backend-1 -f &) | grep -q "Application startup complete" || true'
bash -c '(docker logs test_domain_1-frontend-1 -f &) | grep -q "event - compiled .* successfully\|nginx" || true'
; run cypress
bash -c 'HTTP_PORT=9082 yarn cypress:run'
bash -c 'HAGRID_ART=false hagrid land test_domain_1'
[flake8]
ignore =
W503
max-line-length = 120
exclude =
.tox
[mypy]
python_version = 3.10