-
Notifications
You must be signed in to change notification settings - Fork 416
1020 lines (998 loc) · 35.6 KB
/
test_frameworks.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
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
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Framework tests
on:
# DEV: Removing these from PRs for now while
# we investigate the value of framework tests.
# They will run nightly instead, and manual
# workflow dispatch will be enabled
# push:
# branches:
# - main
# - 'mq-working-branch**'
# pull_request:
workflow_dispatch: {}
schedule:
- cron: '0 5 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
needs-run:
runs-on: ubuntu-latest
outputs:
outcome: ${{ steps.run_needed.outcome }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- id: run_needed
name: Check if run is needed
run: |
git fetch origin ${{ github.event.pull_request.base.sha }}
export PATHS=$(git diff --name-only HEAD ${{ github.event.pull_request.base.sha }})
python -c "import os,sys,fnmatch;sys.exit(not bool([_ for pattern in {'ddtrace/*', 'setup*', 'pyproject.toml', '.github/workflows/test_frameworks.yml', 'tests/debugging/exploration/*'} for _ in fnmatch.filter(os.environ['PATHS'].splitlines(), pattern)]))"
continue-on-error: true
bottle-testsuite:
strategy:
matrix:
include:
- suffix: Profiling
profiling: 1
iast: 0
appsec: 0
- suffix: IAST
profiling: 0
iast: 1
appsec: 0
- suffix: APPSEC
profiling: 0
iast: 0
appsec: 1
- suffix: Tracer only
profiling: 0
iast: 0
appsec: 0
name: Bottle 0.12.25 (with ${{ matrix.suffix }})
runs-on: ubuntu-latest
needs: needs-run
env:
DD_PROFILING_ENABLED: ${{ matrix.profiling }}
DD_IAST_ENABLED: ${{ matrix.iast }}
DD_APPSEC_ENABLED: ${{ matrix.appsec }}
DD_TESTING_RAISE: true
CMAKE_BUILD_PARALLEL_LEVEL: 12
DD_DEBUGGER_EXPL_OUTPUT_FILE: debugger-expl.txt
defaults:
run:
working-directory: bottle
steps:
- uses: actions/setup-python@v5
if: needs.needs-run.outputs.outcome == 'success'
with:
python-version: '3.9'
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
path: ddtrace
persist-credentials: false
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
repository: bottlepy/bottle
ref: 0.12.25
path: bottle
- name: Install Dependencies
if: needs.needs-run.outputs.outcome == 'success'
run: sudo apt-get install -y libev-dev
- name: Test dependencies (Server back-ends and template engines)
if: needs.needs-run.outputs.outcome == 'success'
# adapted from install script inside of .github/workflows of test suite (https://github.com/bottlepy/bottle/blob/master/.github/workflows/run_tests.yml)
run: |
for name in pip pytest coverage mako jinja2 waitress "cherrypy<9" cheroot paste tornado twisted diesel meinheld\
gunicorn eventlet flup bjoern gevent aiohttp-wsgi uvloop; do
pip install $name || echo "Failed to install $name with $(python -V 2>&1)" 1>&2
done
- name: Inject ddtrace
if: needs.needs-run.outputs.outcome == 'success'
run: pip install ../ddtrace
# Allows tests to continue through deprecation warnings for jinja2 and mako
- name: Run tests
if: needs.needs-run.outputs.outcome == 'success'
# Disable all test_simple tests because they check for
# log output and it contains phony error messages.
run: PYTHONPATH=../ddtrace/tests/debugging/exploration/ ddtrace-run pytest test --continue-on-collection-errors -v -k 'not test_simple'
- name: Debugger exploration result
if: needs.needs-run.outputs.outcome == 'success'
run: cat debugger-expl.txt
sanic-testsuite:
strategy:
matrix:
include:
# TODO: profiling fails with a timeout error
#- suffix: Profiling
# profiling: 1
# iast: 0
# appsec: 0
- suffix: IAST
profiling: 0
iast: 1
appsec: 0
- suffix: APPSEC
profiling: 0
iast: 0
appsec: 1
- suffix: Tracer only
profiling: 0
iast: 0
appsec: 0
name: Sanic 24.6 (with ${{ matrix.suffix }})
runs-on: ubuntu-20.04
needs: needs-run
timeout-minutes: 15
env:
DD_PROFILING_ENABLED: ${{ matrix.profiling }}
DD_IAST_ENABLED: ${{ matrix.iast }}
DD_APPSEC_ENABLED: ${{ matrix.appsec }}
DD_TESTING_RAISE: true
CMAKE_BUILD_PARALLEL_LEVEL: 12
DD_DEBUGGER_EXPL_OUTPUT_FILE: debugger-expl.txt
defaults:
run:
working-directory: sanic
steps:
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
path: ddtrace
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
repository: sanic-org/sanic
ref: v24.6.0
path: sanic
- uses: actions/setup-python@v5
if: needs.needs-run.outputs.outcome == 'success'
with:
python-version: "3.11"
- name: Install sanic and dependencies required to run tests
if: needs.needs-run.outputs.outcome == 'success'
run: pip3 install '.[test]' aioquic
- name: Install ddtrace
if: needs.needs-run.outputs.outcome == 'success'
run: pip3 install ../ddtrace
- name: Run tests
if: needs.needs-run.outputs.outcome == 'success'
run: ddtrace-run pytest -k "not test_reloader and not test_reload_listeners and not test_no_exceptions_when_cancel_pending_request and not test_add_signal and not test_ode_removes and not test_skip_touchup and not test_dispatch_signal_triggers and not test_keep_alive_connection_context and not test_redirect_with_params and not test_keep_alive_client_timeout and not test_logger_vhosts and not test_ssl_in_multiprocess_mode"
django-testsuite:
strategy:
matrix:
include:
#- suffix: DI profiler
# expl_profiler: 1
# expl_coverage: 0
# profiling: 1
# iast: 0
# appsec: 0
#- suffix: DI coverage
# expl_profiler: 0
# expl_coverage: 1
# profiling: 1
# iast: 0
# appsec: 0
# Disabled while the bug is investigated: APPSEC-53222
# - suffix: IAST
# expl_profiler: 0
# expl_coverage: 0
# profiling: 0
# iast: 1
# appsec: 0
- suffix: APPSEC
expl_profiler: 0
expl_coverage: 0
profiling: 0
iast: 0
appsec: 1
- suffix: Tracer only
expl_profiler: 0
expl_coverage: 0
profiling: 0
iast: 0
appsec: 0
runs-on: ubuntu-latest
needs: needs-run
timeout-minutes: 15
name: Django 5.0.7 (with ${{ matrix.suffix }})
env:
DD_PROFILING_ENABLED: ${{ matrix.profiling }}
DD_IAST_ENABLED: ${{ matrix.iast }}
DD_APPSEC_ENABLED: ${{ matrix.appsec }}
DD_APPSEC_AUTOMATED_USER_EVENTS_TRACKING: disabled # To avoid a couple failures due to the extra query
DD_APPSEC_AUTOMATED_USER_EVENTS_TRACKING_ENABLED: false # To avoid a couple failures due to the extra query
DD_TESTING_RAISE: true
DD_DEBUGGER_EXPL_ENCODE: 0 # Disabled to speed up
DD_DEBUGGER_EXPL_PROFILER_ENABLED: ${{ matrix.expl_profiler }}
DD_DEBUGGER_EXPL_PROFILER_DELETE_FUNCTION_PROBES: 1 # Delete to speed up
DD_DEBUGGER_EXPL_COVERAGE_ENABLED: ${{ matrix.expl_coverage }}
DD_DEBUGGER_EXPL_COVERAGE_DELETE_LINE_PROBES: 1 # Delete to speed up
DD_DEBUGGER_EXPL_CONSERVATIVE: 1
DD_DEBUGGER_EXPL_OUTPUT_FILE: debugger-expl.txt
PYTHONPATH: ../ddtrace/tests/debugging/exploration/:.
CMAKE_BUILD_PARALLEL_LEVEL: 12
defaults:
run:
working-directory: django
steps:
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
path: ddtrace
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
repository: django/django
ref: 5.0.7
path: django
- uses: actions/setup-python@v5
if: needs.needs-run.outputs.outcome == 'success'
with:
python-version: "3.11"
- name: Install pylibmc libmemcached package
if: needs.needs-run.outputs.outcome == 'success'
# Django-specific: pylibmc in Ubuntu requires libmemcached package
run: |
sudo apt update -qq
sudo apt install --no-install-recommends -qqyf libmemcached-dev zlib1g
- name: Install dependencies
if: needs.needs-run.outputs.outcome == 'success'
# Django-specific: separate dependencies for tests
run: pip install -r tests/requirements/py3.txt
- name: Install ddtrace
if: needs.needs-run.outputs.outcome == 'success'
run: |
pip install envier Cython cmake
pip install ../ddtrace
- name: Install django
if: needs.needs-run.outputs.outcome == 'success'
run: pip install -e .
- name: Disable unsupported tests
if: needs.needs-run.outputs.outcome == 'success'
run: |
# Note: test_supports_json_field_operational_error will fail with the tracer
# DEV: Insert @skipUnless before the test definition
# DEV: We need to escape the space indenting
sed -i'' '/def test_supports_json_field_operational_error/i \ \ \ \ @skipUnless(False, "test not supported by dd-trace-py")' tests/backends/sqlite/test_features.py
sed -i'' 's/if not filename.startswith(os.path.dirname(django.__file__))/if False/' django/conf/__init__.py
sed -i'' 's/test_paginating_unordered_queryset_raises_warning/paginating_unordered_queryset_raises_warning/' tests/pagination/tests.py
sed -i'' 's/test_get_or_set_version/get_or_set_version/' tests/cache/tests.py
sed -i'' 's/test_avoid_infinite_loop_on_too_many_subqueries/avoid_infinite_loop_on_too_many_subqueries/' tests/queries/tests.py
sed -i'' 's/test_multivalue_dict_key_error/multivalue_dict_key_error/' tests/view_tests/tests/test_debug.py # Sensitive data leak
sed -i'' 's/test_db_table/db_table/' tests/schema/tests.py
sed -i'' 's/test_custom_fields/custom_fields/' tests/inspectdb/tests.py
sed -i'' 's/test_access_warning/access_warning/' tests/deprecation/test_storages.py
sed -i'' 's/test_authenticate_sensitive_variables/sensitive_variables/' tests/auth_tests/test_auth_backends.py
sed -i'' 's/test_zip_reload/zip_reload/' tests/utils_tests/test_autoreload.py
sed -i'' 's/test_repr_functools_partial/repr_functools_partial/' tests/urlpatterns_reverse/tests.py
sed -i'' 's/test_class_attributes/class_attributes/' tests/generic_views/test_base.py
sed -i'' 's/test_aauthenticate_sensitive_variables/aauthenticate_sensitive_variables/' tests/auth_tests/test_auth_backends.py
- name: Run tests
if: needs.needs-run.outputs.outcome == 'success'
# django.tests.requests module interferes with requests library patching in the tracer -> disable requests patch
run: DD_PATCH_MODULES=unittest:no DD_TRACE_REQUESTS_ENABLED=0 ddtrace-run tests/runtests.py --parallel 1
- name: Debugger exploration results
if: needs.needs-run.outputs.outcome == 'success'
run: cat debugger-expl.txt
graphene-testsuite-3_0:
strategy:
matrix:
include:
- suffix: Profiling
profiling: 1
iast: 0
appsec: 0
- suffix: IAST
profiling: 0
iast: 1
appsec: 0
- suffix: APPSEC
profiling: 0
iast: 0
appsec: 1
- suffix: Tracer only
profiling: 0
iast: 0
appsec: 0
name: Graphene 3.0 (with ${{ matrix.suffix }})
runs-on: ubuntu-latest
needs: needs-run
env:
DD_PROFILING_ENABLED: ${{ matrix.profiling }}
DD_IAST_ENABLED: ${{ matrix.iast }}
DD_APPSEC_ENABLED: ${{ matrix.appsec }}
PYTHONPATH: ../ddtrace/tests/debugging/exploration/:.
DD_DEBUGGER_EXPL_OUTPUT_FILE: debugger-expl.txt
CMAKE_BUILD_PARALLEL_LEVEL: 12
defaults:
run:
working-directory: graphene
steps:
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
path: ddtrace
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
repository: graphql-python/graphene
# TODO: bump ref to `graphene>3.0.0`.
# Unreleased CI fix: https://github.com/graphql-python/graphene/pull/1412
ref: 03277a55123fd2f8a8465c5fa671f7fb0d004c26
path: graphene
- uses: actions/setup-python@v5
if: needs.needs-run.outputs.outcome == 'success'
with:
python-version: "3.9"
- name: Install graphene
if: needs.needs-run.outputs.outcome == 'success'
run: pip install -e "../graphene[test]"
- name: "Upgrade pytest_asyncio"
if: needs.needs-run.outputs.outcome == 'success'
# pytest_asyncio==0.17 raises `assert type in (None, "pathlist", "args", "linelist", "bool")`
# https://github.com/graphql-python/graphene/blob/03277a55123fd2f8a8465c5fa671f7fb0d004c26/setup.py#L52
run: pip install "pytest-asyncio>0.17,<2"
- name: Install ddtrace
if: needs.needs-run.outputs.outcome == 'success'
run: pip install ../ddtrace
- name: Run tests
if: needs.needs-run.outputs.outcome == 'success'
run: ddtrace-run pytest graphene
- name: Debugger exploration results
if: needs.needs-run.outputs.outcome == 'success'
run: cat debugger-expl.txt
fastapi-testsuite-0_92:
strategy:
matrix:
include:
- suffix: Profiling
profiling: 1
iast: 0
appsec: 0
- suffix: IAST
profiling: 0
iast: 1
appsec: 0
- suffix: APPSEC
profiling: 0
iast: 0
appsec: 1
- suffix: Tracer only
profiling: 0
iast: 0
appsec: 0
name: FastAPI 0.92 (with ${{ matrix.suffix }})
runs-on: ubuntu-latest
needs: needs-run
env:
DD_TESTING_RAISE: true
DD_PROFILING_ENABLED: ${{ matrix.profiling }}
DD_IAST_ENABLED: ${{ matrix.iast }}
DD_APPSEC_ENABLED: ${{ matrix.appsec }}
CMAKE_BUILD_PARALLEL_LEVEL: 12
DD_DEBUGGER_EXPL_OUTPUT_FILE: debugger-expl.txt
defaults:
run:
working-directory: fastapi
steps:
- uses: actions/setup-python@v5
if: needs.needs-run.outputs.outcome == 'success'
with:
python-version: '3.9'
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
path: ddtrace
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
repository: tiangolo/fastapi
ref: 0.92.0
path: fastapi
- uses: actions/[email protected]
if: needs.needs-run.outputs.outcome == 'success'
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-fastapi
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true' && needs.needs-run.outputs.outcome == 'success'
run: pip install -e .[all,dev,doc,test]
- name: Inject ddtrace
if: needs.needs-run.outputs.outcome == 'success'
run: pip install ../ddtrace
- name: Test
if: needs.needs-run.outputs.outcome == 'success'
# https://github.com/tiangolo/fastapi/pull/10876
run: PYTHONPATH=../ddtrace/tests/debugging/exploration/ ddtrace-run pytest -p no:warnings tests -k 'not test_warn_duplicate_operation_id'
- name: Debugger exploration results
if: needs.needs-run.outputs.outcome == 'success'
run: cat debugger-expl.txt
flask-testsuite:
strategy:
matrix:
include:
- suffix: Profiling
profiling: 1
iast: 0
appsec: 0
- suffix: IAST
profiling: 0
iast: 1
appsec: 0
- suffix: APPSEC
profiling: 0
iast: 0
appsec: 1
- suffix: Tracer only
profiling: 0
iast: 0
appsec: 0
name: Flask 3.0.3 (with ${{ matrix.suffix }})
runs-on: ubuntu-latest
needs: needs-run
env:
TOX_TESTENV_PASSENV: DD_TESTING_RAISE DD_PROFILING_ENABLED
DD_TESTING_RAISE: true
DD_PROFILING_ENABLED: ${{ matrix.profiling }}
DD_IAST_ENABLED: ${{ matrix.iast }}
DD_APPSEC_ENABLED: ${{ matrix.appsec }}
PYTHONPATH: ../ddtrace/tests/debugging/exploration/
CMAKE_BUILD_PARALLEL_LEVEL: 12
defaults:
run:
working-directory: flask
steps:
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
path: ddtrace
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
repository: pallets/flask
ref: 3.0.3
path: flask
- uses: actions/setup-python@v5
if: needs.needs-run.outputs.outcome == 'success'
with:
python-version: '3.12'
- name: Install tox
if: needs.needs-run.outputs.outcome == 'success'
run: pip install tox
- name: Create tox env
if: needs.needs-run.outputs.outcome == 'success'
run: tox -e py3.12 --notest
- name: Add pytest configuration for ddtrace
if: needs.needs-run.outputs.outcome == 'success'
run: touch pyproject.toml && echo -e "[tool.pytest.inioptions]\nddtrace-patch-all = 1" >> pyproject.toml
- name: Run tests
if: needs.needs-run.outputs.outcome == 'success'
run: |
source .tox/py3.12/bin/activate
pip install ../ddtrace
tox run -e py3.12
httpx-testsuite-0_22_0:
strategy:
matrix:
include:
- suffix: IAST
iast: 1
appsec: 0
- suffix: APPSEC
iast: 0
appsec: 1
- suffix: Tracer only
iast: 0
appsec: 0
name: Httpx 0.22.0 (with ${{ matrix.suffix }})
runs-on: ubuntu-latest
needs: needs-run
defaults:
run:
working-directory: httpx
steps:
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
path: ddtrace
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
repository: encode/httpx
ref: 0.22.0
path: httpx
- uses: actions/setup-python@v5
if: needs.needs-run.outputs.outcome == 'success'
with:
python-version: '3.9'
- name: Install dependencies
if: needs.needs-run.outputs.outcome == 'success'
run: |
pip install pip==24.0
pip install -r requirements.txt
- name: Inject ddtrace
if: needs.needs-run.outputs.outcome == 'success'
run: pip install ../ddtrace
- name: Add pytest configuration for ddtrace
if: needs.needs-run.outputs.outcome == 'success'
run: echo -e "[pytest]\nddtrace-patch-all = 1" > pytest.ini
- name: Run tests
if: needs.needs-run.outputs.outcome == 'success'
env:
# Disabled distributed tracing since there are a lot of tests that assert on headers
DD_HTTPX_DISTRIBUTED_TRACING: "false"
# Debugger exploration testing does not work in CI
# PYTHONPATH: ../ddtrace/tests/debugging/exploration/
DD_IAST_ENABLED: ${{ matrix.iast }}
DD_APPSEC_ENABLED: ${{ matrix.appsec }}
# test_pool_timeout raises RuntimeError: The connection pool was closed while 1 HTTP requests/responses were still in-flight
run: pytest -k 'not test_pool_timeout'
mako-testsuite:
strategy:
matrix:
include:
- suffix: Profiling
profiling: 1
iast: 0
appsec: 0
- suffix: IAST
profiling: 0
iast: 1
appsec: 0
- suffix: APPSEC
profiling: 0
iast: 0
appsec: 1
- suffix: Tracer only
profiling: 0
iast: 0
appsec: 0
name: Mako 1.3.5 (with ${{ matrix.suffix }})
runs-on: ubuntu-latest
needs: needs-run
env:
TOX_TESTENV_PASSENV: DD_TESTING_RAISE DD_PROFILING_ENABLED
DD_TESTING_RAISE: true
DD_PROFILING_ENABLED: ${{ matrix.profiling }}
DD_IAST_ENABLED: ${{ matrix.iast }}
DD_APPSEC_ENABLED: ${{ matrix.appsec }}
PYTHONPATH: ../ddtrace/tests/debugging/exploration/
CMAKE_BUILD_PARALLEL_LEVEL: 12
defaults:
run:
working-directory: mako
steps:
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
path: ddtrace
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
repository: sqlalchemy/mako
ref: rel_1_3_5
path: mako
- uses: actions/setup-python@v5
if: needs.needs-run.outputs.outcome == 'success'
with:
python-version: '3.12'
- name: Install tox
if: needs.needs-run.outputs.outcome == 'success'
run: pip install tox
- name: Create tox env
if: needs.needs-run.outputs.outcome == 'success'
run: tox -e py312 --notest
- name: Add pytest configuration for ddtrace
if: needs.needs-run.outputs.outcome == 'success'
run: touch tox.ini && echo -e "[pytest]\nddtrace-patch-all = 1" >> tox.ini
- name: Run tests
if: needs.needs-run.outputs.outcome == 'success'
run: |
source .tox/py312/bin/activate
pip install ../ddtrace
tox run -e py312
starlette-testsuite-0_38_4:
strategy:
matrix:
include:
- suffix: Profiling
profiling: 1
iast: 0
appsec: 0
- suffix: IAST
profiling: 0
iast: 1
appsec: 0
- suffix: Tracer only
profiling: 0
iast: 0
appsec: 0
- suffix: APPSEC
profiling: 0
iast: 0
appsec: 1
name: Starlette 0.38.4 (with ${{ matrix.suffix }})
runs-on: "ubuntu-latest"
needs: needs-run
timeout-minutes: 30
env:
DD_TESTING_RAISE: true
DD_PROFILING_ENABLED: ${{ matrix.profiling }}
DD_IAST_ENABLED: ${{ matrix.iast }}
DD_APPSEC_ENABLED: ${{ matrix.appsec }}
PYTHONPATH: ../ddtrace/tests/debugging/exploration/
DD_DEBUGGER_EXPL_OUTPUT_FILE: debugger-expl.txt
CMAKE_BUILD_PARALLEL_LEVEL: 12
defaults:
run:
working-directory: starlette
steps:
- uses: actions/setup-python@v5
if: needs.needs-run.outputs.outcome == 'success'
with:
python-version: '3.9'
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
path: ddtrace
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
repository: encode/starlette
ref: 0.38.4
path: starlette
- name: Install ddtrace
if: needs.needs-run.outputs.outcome == 'success'
run: |
pip install envier Cython cmake
pip install ../ddtrace
- name: Install dependencies
if: needs.needs-run.outputs.outcome == 'success'
run: pip install -r requirements.txt
#Parameters for keyword expression skip 3 failing tests that are expected due to asserting on headers. The errors are because our context propagation headers are being added
#test_staticfiles_with_invalid_dir_permissions_returns_401 fails with and without ddtrace enabled
- name: Run tests
if: needs.needs-run.outputs.outcome == 'success'
run: pytest -W ignore --ddtrace-patch-all tests -k 'not test_request_headers and not test_subdomain_route and not test_websocket_headers and not test_staticfiles_with_invalid_dir_permissions_returns_401 and not test_contextvars[asyncio-CustomMiddlewareUsingBaseHTTPMiddleware]'
- name: Debugger exploration results
if: needs.needs-run.outputs.outcome == 'success'
run: cat debugger-expl.txt
requests-testsuite-2_26_0:
strategy:
matrix:
include:
- suffix: Profiling
profiling: 1
iast: 0
appsec: 0
- suffix: IAST
profiling: 0
iast: 1
appsec: 0
- suffix: APPSEC
profiling: 0
iast: 0
appsec: 1
- suffix: Tracer only
profiling: 0
iast: 0
appsec: 0
name: Requests 2.26.0 (with ${{ matrix.suffix }})
runs-on: "ubuntu-latest"
needs: needs-run
env:
DD_TESTING_RAISE: true
DD_PROFILING_ENABLED: ${{ matrix.profiling }}
DD_IAST_ENABLED: ${{ matrix.iast }}
DD_APPSEC_ENABLED: ${{ matrix.appsec }}
CMAKE_BUILD_PARALLEL_LEVEL: 12
DD_DEBUGGER_EXPL_OUTPUT_FILE: debugger-expl.txt
defaults:
run:
working-directory: requests
steps:
- uses: actions/setup-python@v5
if: needs.needs-run.outputs.outcome == 'success'
with:
python-version: '3.9'
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
path: ddtrace
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
repository: psf/requests
ref: v2.26.0
path: requests
- name: Install ddtrace
if: needs.needs-run.outputs.outcome == 'success'
run: pip install ../ddtrace
- name: Install dependencies
if: needs.needs-run.outputs.outcome == 'success'
run: "make init"
- name: MarkupSafe fix
if: needs.needs-run.outputs.outcome == 'success'
run: pip install --upgrade MarkupSafe==2.0.1
- name: Pytest fix
if: needs.needs-run.outputs.outcome == 'success'
run: pip install --upgrade pytest==5.4.3
- name: Run tests
if: needs.needs-run.outputs.outcome == 'success'
run: PYTHONPATH=../ddtrace/tests/debugging/exploration/ ddtrace-run pytest -p no:warnings tests
- name: Debugger exploration results
if: needs.needs-run.outputs.outcome == 'success'
run: cat debugger-expl.txt
asyncpg-testsuite:
# https://github.com/MagicStack/asyncpg/blob/v0.25.0/.github/workflows/tests.yml#L125
strategy:
matrix:
include:
- suffix: Profiling
profiling: 1
iast: 0
appsec: 0
- suffix: IAST
profiling: 0
iast: 1
appsec: 0
- suffix: APPSEC
profiling: 0
iast: 0
appsec: 1
- suffix: Tracer only
profiling: 0
iast: 0
appsec: 0
name: AsyncPG 0.29.0 (with ${{ matrix.suffix }})
runs-on: "ubuntu-latest"
needs: needs-run
env:
DD_TESTING_RAISE: true
DD_PROFILING_ENABLED: ${{ matrix.profiling }}
DD_IAST_ENABLED: ${{ matrix.iast }}
DD_APPSEC_ENABLED: ${{ matrix.appsec }}
CMAKE_BUILD_PARALLEL_LEVEL: 12
defaults:
run:
working-directory: asyncpg
steps:
- uses: actions/setup-python@v5
if: needs.needs-run.outputs.outcome == 'success'
with:
python-version: '3.9'
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
path: ddtrace
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
repository: magicstack/asyncpg
ref: v0.29.0
path: asyncpg
fetch-depth: 50
submodules: true
- name: Install ddtrace
if: needs.needs-run.outputs.outcome == 'success'
run: pip install ../ddtrace
- name: Install dependencies
if: needs.needs-run.outputs.outcome == 'success'
run: |
python -m pip install -U pip setuptools wheel pytest
python -m pip install -e .[test]
- name: Run tests
if: needs.needs-run.outputs.outcome == 'success'
# Disable tests checking GC references since profiling can interfere
run: ddtrace-run python -m pytest -k 'not test_record_gc and not test_record_get and not test_record_items and not test_record_iter' tests
gunicorn-testsuite-20_1_0:
strategy:
matrix:
include:
- suffix: IAST
iast: 1
appsec: 0
- suffix: APPSEC
iast: 0
appsec: 1
- suffix: Tracer only
iast: 0
appsec: 0
name: gunicorn 20.1.0 (with ${{ matrix.suffix }})
runs-on: "ubuntu-latest"
needs: needs-run
env:
DD_TESTING_RAISE: true
DD_IAST_ENABLED: ${{ matrix.iast }}
DD_APPSEC_ENABLED: ${{ matrix.appsec }}
# PYTHONPATH: ../ddtrace/tests/debugging/exploration/
CMAKE_BUILD_PARALLEL_LEVEL: 12
defaults:
run:
working-directory: gunicorn
steps:
- uses: actions/setup-python@v5
if: needs.needs-run.outputs.outcome == 'success'
with:
python-version: '3.9'
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
path: ddtrace
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
repository: benoitc/gunicorn
ref: 20.1.0
path: gunicorn
- name: Run tests
if: needs.needs-run.outputs.outcome == 'success'
run: |
. ../ddtrace/.github/workflows/setup-tox.sh py39
pip install -e .
pytest -p no:warnings -k "not test_import" tests/
uwsgi-testsuite-2_0_21:
strategy:
matrix:
include:
- suffix: Profiling
profiling: 1
iast: 0
appsec: 0
- suffix: IAST
profiling: 0
iast: 1
appsec: 0
- suffix: APPSEC
profiling: 0
iast: 0
appsec: 1
- suffix: Tracer only
profiling: 0
iast: 0
appsec: 0
name: uwsgi 2.0.21 (with ${{ matrix.suffix }})
runs-on: "ubuntu-latest"
needs: needs-run
env:
DD_TESTING_RAISE: true
DD_PROFILING_ENABLED: ${{ matrix.profiling }}
DD_IAST_ENABLED: ${{ matrix.iast }}
DD_APPSEC_ENABLED: ${{ matrix.appsec }}
PYTHONPATH: ../ddtrace/tests/debugging/exploration/
DD_DEBUGGER_EXPL_OUTPUT_FILE: debugger-expl.txt
CMAKE_BUILD_PARALLEL_LEVEL: 12
defaults:
run:
working-directory: uwsgi
steps:
- uses: actions/setup-python@v5
if: needs.needs-run.outputs.outcome == 'success'
with:
python-version: '3.9'
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
path: ddtrace
- uses: actions/checkout@v4
if: needs.needs-run.outputs.outcome == 'success'
with:
persist-credentials: false
repository: unbit/uwsgi
ref: 2.0.21
path: uwsgi
- name: Install dependencies
if: needs.needs-run.outputs.outcome == 'success'
run: |
sudo apt update -qq
sudo apt install --no-install-recommends -qqyf python3-dev \
libpcre3-dev libjansson-dev libcap2-dev \
curl check
- name: Install distutils
if: needs.needs-run.outputs.outcome == 'success'
run: sudo apt install --no-install-recommends -qqyf python3-distutils
- name: Install ddtrace
if: needs.needs-run.outputs.outcome == 'success'
run: pip install ../ddtrace
- name: Build uwsgi binary
if: needs.needs-run.outputs.outcome == 'success'
run: make
- name: Build Python plugin
if: needs.needs-run.outputs.outcome == 'success'
run: |
python -V
python uwsgiconfig.py --plugin plugins/python base python39
- name: Run Python tests
if: needs.needs-run.outputs.outcome == 'success'
run: ddtrace-run ./tests/gh-python.sh python39
- name: Run deadlock tests
if: needs.needs-run.outputs.outcome == 'success'
run: ddtrace-run ./tests/gh-deadlocks.sh python39
- name: Debugger exploration results
if: needs.needs-run.outputs.outcome == 'success'
run: cat debugger-expl.txt
beautifulsoup-testsuite-4_12_3:
strategy:
matrix:
include:
# TODO: profiling is disabled due to a bug in the profiler paths
# - suffix: Profiling
# profiling: 1
# iast: 0
# appsec: 0
- suffix: IAST
profiling: 0
iast: 1
appsec: 0
- suffix: APPSEC
profiling: 0
iast: 0
appsec: 1
- suffix: Tracer only
profiling: 0
iast: 0
appsec: 0
name: Beautifulsoup 4.12.3 (with ${{ matrix.suffix }})
runs-on: "ubuntu-latest"
needs: needs-run
env:
DD_TESTING_RAISE: true
DD_PROFILING_ENABLED: ${{ matrix.profiling }}
DD_IAST_ENABLED: ${{ matrix.iast }}
DD_APPSEC_ENABLED: ${{ matrix.appsec }}
CMAKE_BUILD_PARALLEL_LEVEL: 12
DD_DEBUGGER_EXPL_OUTPUT_FILE: debugger-expl.txt
steps:
- uses: actions/setup-python@v5
if: needs.needs-run.outputs.outcome == 'success'