-
-
Notifications
You must be signed in to change notification settings - Fork 580
/
ddevapp_test.go
4285 lines (3655 loc) · 150 KB
/
ddevapp_test.go
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
package ddevapp_test
import (
"bufio"
"fmt"
"net"
"net/url"
"os"
"path"
"path/filepath"
"regexp"
"runtime"
"sort"
"strconv"
"strings"
"testing"
"time"
"github.com/ddev/ddev/pkg/archive"
"github.com/ddev/ddev/pkg/config/types"
"github.com/ddev/ddev/pkg/ddevapp"
ddevImages "github.com/ddev/ddev/pkg/docker"
"github.com/ddev/ddev/pkg/dockerutil"
"github.com/ddev/ddev/pkg/exec"
"github.com/ddev/ddev/pkg/fileutil"
"github.com/ddev/ddev/pkg/globalconfig"
"github.com/ddev/ddev/pkg/nodeps"
"github.com/ddev/ddev/pkg/output"
"github.com/ddev/ddev/pkg/testcommon"
"github.com/ddev/ddev/pkg/util"
"github.com/ddev/ddev/pkg/versionconstants"
dockerContainer "github.com/docker/docker/api/types/container"
dockerVolume "github.com/docker/docker/api/types/volume"
"github.com/docker/go-connections/nat"
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
asrt "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
var (
DdevBin = "ddev"
TestSites = []testcommon.TestSite{
// 0: wordpress
{
Name: "TestPkgWordpress",
SourceURL: "https://wordpress.org/wordpress-6.0.1.tar.gz",
ArchiveInternalExtractionPath: "wordpress/",
FilesTarballURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/wordpress5.8.2_files.tar.gz",
DBTarURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/wordpress5.8.2_db.sql.tar.gz",
Docroot: "",
Type: nodeps.AppTypeWordPress,
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/readme.html", Expect: "Welcome. WordPress is a very special project to me."},
DynamicURI: testcommon.URIWithExpect{URI: "/", Expect: "this post has a photo"},
FilesImageURI: "/wp-content/uploads/2021/12/DSCF0436-randy-and-nancy-with-traditional-wedding-out-fit-2048x1536.jpg",
},
// 1: drupal8
{
Name: "TestPkgDrupal8",
SourceURL: "https://ftp.drupal.org/files/projects/drupal-8.9.20.tar.gz",
ArchiveInternalExtractionPath: "drupal-8.9.20/",
FilesTarballURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/d8_umami.files.tar.gz",
FilesZipballURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/d8_umami.files.zip",
DBTarURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/d8_umami.sql.tar.gz",
DBZipURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/d8_umami.sql.zip",
FullSiteTarballURL: "",
Type: nodeps.AppTypeDrupal,
Docroot: "",
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/README.txt", Expect: "Drupal is an open source content management platform"},
DynamicURI: testcommon.URIWithExpect{URI: "/node/2", Expect: "Vegan chocolate and nut brownies"},
FilesImageURI: "/sites/default/files/vegan-chocolate-nut-brownies.jpg",
},
// 2: drupal7
{
Name: "TestPkgDrupal7", // Drupal D7
SourceURL: "https://ftp.drupal.org/files/projects/drupal-7.90.tar.gz",
ArchiveInternalExtractionPath: "drupal-7.90/",
FilesTarballURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/d7test-7.59.files.tar.gz",
DBTarURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/d7test-7.87-db.tar.gz",
FullSiteTarballURL: "",
Docroot: "",
Type: nodeps.AppTypeDrupal7,
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/README.txt", Expect: "Drupal is an open source content management platform"},
DynamicURI: testcommon.URIWithExpect{URI: "/node/1", Expect: "D7 test project, kittens edition"},
FilesImageURI: "/sites/default/files/field/image/kittens-large.jpg",
FullSiteArchiveExtPath: "docroot/sites/default/files",
},
// 3: drupal6
{
Name: "TestPkgDrupal6",
SourceURL: "https://ftp.drupal.org/files/projects/drupal-6.38.tar.gz",
ArchiveInternalExtractionPath: "drupal-6.38/",
DBTarURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/drupal6.38_db.tar.gz",
FullSiteTarballURL: "",
FilesTarballURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/drupal6_files.tar.gz",
Docroot: "",
Type: nodeps.AppTypeDrupal6,
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/CHANGELOG.txt", Expect: "Drupal 6.38, 2016-02-24"},
DynamicURI: testcommon.URIWithExpect{URI: "/node/2", Expect: "This is a story. The story is somewhat shaky"},
FilesImageURI: "/sites/default/files/garland_logo.jpg",
},
// 4: backdrop
{
Name: "TestPkgBackdrop",
SourceURL: "https://github.com/backdrop/backdrop/archive/1.22.0.tar.gz",
ArchiveInternalExtractionPath: "backdrop-1.22.0/",
DBTarURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/backdrop_db.11.0.tar.gz",
FilesTarballURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/backdrop_files.11.0.tar.gz",
FullSiteTarballURL: "",
Docroot: "",
Type: nodeps.AppTypeBackdrop,
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/README.md", Expect: "Backdrop is a full-featured content management system"},
DynamicURI: testcommon.URIWithExpect{URI: "/posts/first-post-all-about-kittens", Expect: "Lots of kittens are a good thing"},
FilesImageURI: "/files/styles/large/public/field/image/kittens-large.jpg",
},
// 5: typo3
{
Name: "TestPkgTypo3",
// tar -czf .tarballs/typo3v11_source.tgz --exclude=var --exclude=public/fileadmin .
SourceURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/typo3v11_source.tgz",
ArchiveInternalExtractionPath: "",
DBTarURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/typo3v11_db.sql.tar.gz",
FilesTarballURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/typo3v11_fileadmin.tgz",
FullSiteTarballURL: "",
Docroot: "public",
Type: nodeps.AppTypeTYPO3,
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/README.txt", Expect: "junk readme simply for reading"},
DynamicURI: testcommon.URIWithExpect{URI: "/", Expect: "This is test text for TestDdevFullSiteSetup"},
FilesImageURI: "/fileadmin/user_upload/Logo.png",
},
// 6: magento1
{
Name: "testpkgmagento",
SourceURL: "https://github.com/OpenMage/magento-lts/archive/refs/tags/v20.0.13.tar.gz",
ArchiveInternalExtractionPath: "magento-lts-20.0.13/",
DBTarURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/TestPkgMagento_db_secure_url.tar.gz",
FilesTarballURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/magento_upload_files.tgz",
FullSiteTarballURL: "",
Docroot: "",
Type: nodeps.AppTypeMagento,
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/LICENSE.txt", Expect: `Open Software License ("OSL")`},
DynamicURI: testcommon.URIWithExpect{URI: "/", Expect: "This is a demo store"},
FilesImageURI: "/media/wrapping/Chrysanthemum.jpg",
},
// 7: magento2
// Note that testpkgmagento2 code is enormous and makes this really, really slow.
// Create a project named testpkgmagento2 and use the magento2 quickstart
// Look at app/env.php and login at the key given by "backend->frontname" with the admin
// credentials in the quickstart.
// Create a product named Unicycle with a picture called unicycle.jpg
// Full docs and management/upgrade at https://github.com/ddev/test-magento2
{
Name: "testpkgmagento2",
// echo "This is a junk" >pub/junk.txt && tar -czf .tarballs/testpkgmagento2_code_no_media.magento2.4.6-p4.tgz --exclude=.ddev --exclude=var --exclude=pub/media --exclude=.tarballs --exclude=app/etc/env.php .
SourceURL: "https://github.com/ddev/test-magento2/releases/download/2.4.6-p4/testpkgmagento2_code_no_media.magento2.4.6-p4.tgz",
ArchiveInternalExtractionPath: "",
// ddev export-db --gzip=false --file=.tarballs/db.sql && tar -czf .tarballs/testpkgmagento2.magento2.4.6-p4.db.tgz -C .tarballs db.sql
DBTarURL: "https://github.com/ddev/test-magento2/releases/download/2.4.6-p4/testpkgmagento2.magento2.4.6-p4.db.tgz",
// tar -czf .tarballs/testpkgmagento2_files.magento2.4.6-p4.tgz -C pub/media .
FilesTarballURL: "https://github.com/ddev/test-magento2/releases/download/2.4.6-p4/testpkgmagento2_files.magento2.4.6-p4.tgz",
FullSiteTarballURL: "",
Docroot: "pub",
Type: nodeps.AppTypeMagento2,
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/junk.txt", Expect: `This is a junk`},
DynamicURI: testcommon.URIWithExpect{URI: "/index.php/unicycle.html", Expect: "unicycle"},
FilesImageURI: "/media/catalog/product/u/n/unicycle.jpg",
},
// 8: drupal9
{
Name: "TestPkgDrupal9",
SourceURL: "https://ftp.drupal.org/files/projects/drupal-9.5.10.tar.gz",
ArchiveInternalExtractionPath: "drupal-9.5.10/",
FilesTarballURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/d9_umami_files.tgz",
FilesZipballURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/d9_umami_files.zip",
DBTarURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/d9_umami_sql.tar.gz",
DBZipURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/d9_umami.sql.zip",
FullSiteTarballURL: "",
Type: nodeps.AppTypeDrupal,
Docroot: "",
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/README.md", Expect: "Drupal is an open source content management platform"},
DynamicURI: testcommon.URIWithExpect{URI: "/node/1", Expect: "Deep mediterranean quiche"},
FilesImageURI: "/sites/default/files/mediterranean-quiche-umami.jpg",
},
// 9: laravel
{
Name: "TestPkgLaravel",
SourceURL: "https://github.com/ddev/test-laravel/archive/refs/tags/11.0.3.1.tar.gz",
ArchiveInternalExtractionPath: "test-laravel-11.0.3.1/",
FilesTarballURL: "",
FilesZipballURL: "",
DBTarURL: "https://github.com/ddev/test-laravel/releases/download/11.0.3.1/db.sql.tar.gz",
DBZipURL: "",
FullSiteTarballURL: "",
Type: nodeps.AppTypeLaravel,
Docroot: "public",
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/static/", Expect: "This is a static HTML page"},
DynamicURI: testcommon.URIWithExpect{URI: "/", Expect: "Second message"},
FilesImageURI: "/static/sample-1.jpg",
},
// 10: shopware6
{
Name: "testpkgshopware6",
// tar -czf .tarballs/shopware6_code.tgz --exclude=public/media .
SourceURL: "https://github.com/ddev/test-shopware6/releases/download/v1.0.4/shopware6_code.tgz",
ArchiveInternalExtractionPath: "",
// cd public/media && tar -czf ../../.tarballs/shopware6_files.tgz .
FilesTarballURL: "https://github.com/ddev/test-shopware6/releases/download/v1.0.4/shopware6_files.tgz",
// ddev export-db --gzip=false --file=.tarballs/db.sql && tar -czf .tarballs/shopware6_db.sql.tar.gz -C .tarballs db.sql
DBTarURL: "https://github.com/ddev/test-shopware6/releases/download/v1.0.4/shopware6_db.sql.tar.gz",
FullSiteTarballURL: "",
Type: nodeps.AppTypeShopware6,
Docroot: "public",
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/maintenance.html", Expect: "Our website is currently undergoing maintenance"},
DynamicURI: testcommon.URIWithExpect{URI: "/", Expect: "0180 - 000000"},
FilesImageURI: "/thumbnail/4e/6e/dc/1700858326/hemd_600x600_1920x1920.jpg",
},
// 11: php
{
Name: "TestPkgPHP",
SourceURL: "https://github.com/ddev/ddev-test-php-repo/archive/refs/tags/v1.1.0.tar.gz",
ArchiveInternalExtractionPath: "ddev-test-php-repo-1.1.0/",
FullSiteTarballURL: "",
FilesTarballURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/drupal6_files.tar.gz",
Docroot: "",
Type: nodeps.AppTypePHP,
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/README.txt", Expect: "This is a simple readme."},
DynamicURI: testcommon.URIWithExpect{URI: "/index.php", Expect: "This program makes use of the Zend Scripting Language Engine"},
},
// 12: drupal10
{
Name: "TestPkgDrupal10",
SourceURL: "https://ftp.drupal.org/files/projects/drupal-10.1.6.tar.gz",
ArchiveInternalExtractionPath: "drupal-10.1.6/",
FilesTarballURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/drupal10-files.tgz",
DBTarURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/drupal10-alpha6.sql.tar.gz",
FullSiteTarballURL: "",
Type: nodeps.AppTypeDrupal,
Docroot: "",
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/README.md", Expect: "Drupal is an open source content management platform"},
DynamicURI: testcommon.URIWithExpect{URI: "/", Expect: "This is a test page"},
FilesImageURI: "/sites/default/files/2022-07/Logo.png",
},
// 13: craftcms
// Don’t use the official source file at https://craftcms.com/latest-v4.zip, as the version
// changes over time meaning that it will get out of sync with the database. Instead, create
// a project named `testpkgcraftcms` and follow the instructions in the Craft CMS quickstart
// guide, ensuring that the page at `https://testpkgcraftcms.site.dev` works and displays the
// text “Thanks for installing Craft CMS”. Since Craft’s public web folder doesn’t contain any
// static HTML files, you'll need to add one at `web/test.html` that contains the text “Thanks
// for testing Craft CMS”. Zip it up (as a `.zip` or `.tar.gz` file) in a folder and add the
// folder name to `ArchiveInternalExtractionPath`. Export the database, compress the file (must
// be a `.tar.gz` file, `.zip` will NOT work) and add to `DBTarURL`.
{
Name: "TestPkgCraftCms",
SourceURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/craft-cms-4.2.3.zip",
ArchiveInternalExtractionPath: "cms-4.2.3/",
FilesTarballURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/craftcms-4.2.3-files.tar.gz",
DBTarURL: "https://github.com/ddev/ddev_test_tarballs/releases/download/v1.1/craftcms-4.2.3-db.sql.tar.gz",
FullSiteTarballURL: "",
Type: nodeps.AppTypeCraftCms,
Docroot: "web",
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/test.html", Expect: "Thanks for testing Craft CMS"},
UploadDirs: []string{"files"},
DynamicURI: testcommon.URIWithExpect{URI: "/", Expect: "Thanks for installing Craft CMS"},
FilesImageURI: "/files/happy-brad.jpg",
},
// 14: python generic
// Uses https://github.com/ddev/test-flask-sayhello fork of
// https://github.com/greyli/sayhello - no database download required
{
Name: "TestPkgPython",
SourceURL: "https://github.com/ddev/test-flask-sayhello/archive/refs/tags/v1.0.1.tar.gz",
ArchiveInternalExtractionPath: "test-flask-sayhello-1.0.1/",
DBTarURL: "",
FullSiteTarballURL: "",
PretestCmd: "ddev exec flask forge",
WebEnvironment: []string{
"DATABASE_URI=postgresql://db:db@db/db",
"WSGI_APP=sayhello:app",
},
Type: nodeps.AppTypePython,
Docroot: "",
//Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/test.html", Expect: ""},
//UploadDir: "files",
DynamicURI: testcommon.URIWithExpect{URI: "/", Expect: "20 messages"},
FilesImageURI: "",
},
// 15: Django 4
// Uses https://github.com/ddev/test-django4-bakerydemo fork of
// https://github.com/wagtail/bakerydemo - no database download required
{
Name: "TestPkgDjango4",
SourceURL: "https://github.com/ddev/test-django4-bakerydemo/archive/refs/tags/v1.0.1.tar.gz",
ArchiveInternalExtractionPath: "test-django4-bakerydemo-1.0.1/",
DBTarURL: "",
FullSiteTarballURL: "",
PretestCmd: "touch .env && ddev python manage.py migrate >/dev/null && ddev python manage.py load_initial_data && ddev exec pkill -1 gunicorn",
WebEnvironment: []string{
"DJANGO_SETTINGS_MODULE=bakerydemo.settings.dev",
},
Type: nodeps.AppTypeDjango4,
Docroot: "",
//Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/test.html", Expect: ""},
//UploadDir: "files",
DynamicURI: testcommon.URIWithExpect{URI: "/", Expect: "Welcome to the Wagtail Bakery"},
FilesImageURI: "/media/images/Anadama_bread_1.2e16d0ba.fill-180x180-c100.jpg",
},
// 16: Platform django4 template without DJANGO_SETTINGS_MODULE
// Here it has to use the settings file it finds and update that.
// Uses https://github.com/ddev/test-platformsh-templates-django4 fork of
// https://github.com/platformsh-templates/django4 without doing anything to it
{
Name: "TestPkgPlatformDjango4",
SourceURL: "https://github.com/ddev/test-platformsh-templates-django4/archive/refs/tags/v1.0.0.tar.gz",
ArchiveInternalExtractionPath: "test-platformsh-templates-django4-1.0.0/",
DBTarURL: "",
FullSiteTarballURL: "",
Type: nodeps.AppTypeDjango4,
Docroot: "",
DynamicURI: testcommon.URIWithExpect{URI: "/", Expect: "Hello, and welcome to the"},
},
// 17: Silverstripe
{
Name: "TestPkgSilverstripe",
SourceURL: "https://github.com/ddev/test-silverstripe/releases/download/1.0.0/silverstripe-base.tar.gz",
DBTarURL: "https://github.com/ddev/test-silverstripe/releases/download/1.0.0/db.tar.gz",
ArchiveInternalExtractionPath: "",
FullSiteTarballURL: "",
FilesTarballURL: "",
Docroot: "public",
Type: nodeps.AppTypeSilverstripe,
DynamicURI: testcommon.URIWithExpect{URI: "/", Expect: "<meta name=\"generator\" content=\"Silverstripe CMS 5.0\">"},
},
// 18: CakePHP
{
Name: "TestPkgCakePHP",
SourceURL: "https://github.com/ddev/test-cakephp/archive/refs/tags/5.0.1.1.tar.gz",
ArchiveInternalExtractionPath: "test-cakephp-5.0.1.1/",
FilesTarballURL: "",
FilesZipballURL: "",
DBTarURL: "https://github.com/ddev/test-cakephp/releases/download/5.0.1.1/db.sql.tar.gz",
DBZipURL: "",
FullSiteTarballURL: "",
Type: nodeps.AppTypeCakePHP,
Docroot: "webroot",
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/static/page.html", Expect: "This is a static page"},
DynamicURI: testcommon.URIWithExpect{URI: "/", Expect: "CakePHP is able to connect to the database"},
FilesImageURI: "/img/cake.logo.svg",
},
// 19: drupal11
{
Name: "TestPkgDrupal11",
SourceURL: "https://github.com/ddev/test-drupal11/archive/refs/tags/11.x-dev.1.tar.gz",
ArchiveInternalExtractionPath: "test-drupal11-11.x-dev.1/",
FilesTarballURL: "https://github.com/ddev/test-drupal11/releases/download/11.x-dev.1/files.tgz",
DBTarURL: "https://github.com/ddev/test-drupal11/releases/download/11.x-dev.1/db.sql.tar.gz",
FullSiteTarballURL: "",
Type: nodeps.AppTypeDrupal,
Docroot: "web",
Safe200URIWithExpectation: testcommon.URIWithExpect{URI: "/README.md", Expect: "Drupal is an open source content management platform"},
DynamicURI: testcommon.URIWithExpect{URI: "/", Expect: "Super easy vegetarian pasta bake TEST PROJECT"},
FilesImageURI: "/sites/default/files/Logo.png",
},
}
FullTestSites = TestSites
)
func init() {
// Make sets DDEV_BINARY_FULLPATH when building the executable
if os.Getenv("DDEV_BINARY_FULLPATH") != "" {
DdevBin = os.Getenv("DDEV_BINARY_FULLPATH")
}
globalconfig.EnsureGlobalConfig()
}
func TestMain(m *testing.M) {
output.LogSetUp()
// Since this may be the first time DDEV has been used, we need the
// DDEV network available.
dockerutil.EnsureDdevNetwork()
// Avoid having sudo try to add to /etc/hosts.
// This is normally done by Testsite.Prepare()
_ = os.Setenv("DDEV_NONINTERACTIVE", "true")
_ = os.Setenv("MUTAGEN_DATA_DIRECTORY", globalconfig.GetMutagenDataDirectory())
_ = os.Setenv("DOCKER_CLI_HINTS", "false")
// If GOTEST_SHORT is an integer, then use it as index for a single usage
// in the array. Any value can be used, it will default to using the
// first site in the array.
gotestShort := os.Getenv("GOTEST_SHORT")
if gotestShort != "" {
useSite := 0
if site, err := strconv.Atoi(gotestShort); err == nil && site >= 0 && site < len(TestSites) {
useSite = site
}
TestSites = []testcommon.TestSite{TestSites[useSite]}
}
// testRun is the exit result we'll provide.
// Start with a clean exit result, it will be changed if we have trouble.
testRun := 0
err := globalconfig.ReadGlobalConfig()
if err != nil {
log.Fatalf("could not read globalconfig: %v", err)
}
for i, site := range TestSites {
app := &ddevapp.DdevApp{Name: site.Name}
_ = app.Stop(true, false)
_ = globalconfig.RemoveProjectInfo(site.Name)
err := TestSites[i].Prepare()
if err != nil {
log.Fatalf("Prepare() failed on TestSite.Prepare() site=%s, err=%v", TestSites[i].Name, err)
}
switchDir := TestSites[i].Chdir()
testcommon.ClearDockerEnv()
app = &ddevapp.DdevApp{}
err = app.Init(TestSites[i].Dir)
if err != nil {
testRun = -1
log.Errorf("TestMain startup: app.Init() failed on site %s in dir %s, err=%v", TestSites[i].Name, TestSites[i].Dir, err)
continue
}
err = ddevapp.PrepDdevDirectory(app)
if err != nil {
testRun = -1
log.Errorf("TestMain startup: ddevapp.PrepDdevDirectory() failed on site %s in dir %s, err=%v", TestSites[i].Name, TestSites[i].Dir, err)
continue
}
// Use DDEV binary here because app.WriteConfig() doesn't
// populate the project .ddev
err = ddevapp.PopulateExamplesCommandsHomeadditions(app.Name)
if err != nil {
testRun = -1
log.Errorf("TestMain startup: ddevapp.PopulateExamplesCommandsHomeadditions() failed on site %s in dir %s, err=%v", TestSites[i].Name, TestSites[i].Dir, err)
continue
}
err = app.WriteConfig()
if err != nil {
testRun = -1
log.Errorf("TestMain startup: app.WriteConfig() failed on site %s in dir %s, err=%v", TestSites[i].Name, TestSites[i].Dir, err)
continue
}
// Pre-download any images we may need, to get them out of the way so they don't clutter tests
_, err = exec.RunHostCommand("sh", "-c", fmt.Sprintf("%s debug download-images >/dev/null", DdevBin))
if err != nil {
log.Warnf("TestMain startup: failed to ddev debug download-images, site %s in dir %s: %v", TestSites[i].Name, TestSites[i].Dir, err)
}
for _, volume := range []string{app.Name + "-mariadb"} {
err = dockerutil.RemoveVolume(volume)
if err != nil {
log.Errorf("TestMain startup: Failed to delete volume %s: %v", volume, err)
}
}
switchDir()
}
if testRun == 0 {
log.Debugln("Running tests.")
testRun = m.Run()
}
for i, site := range TestSites {
testcommon.ClearDockerEnv()
app := &ddevapp.DdevApp{}
err := app.Init(site.Dir)
if err != nil {
log.Fatalf("TestMain shutdown: app.Init() failed on site %s in dir %s, err=%v", TestSites[i].Name, TestSites[i].Dir, err)
}
status, _ := app.SiteStatus()
if status != ddevapp.SiteStopped {
err = app.Stop(true, false)
if err != nil {
log.Fatalf("TestMain shutdown: app.Stop() failed on site %s, err=%v", TestSites[i].Name, err)
}
}
site.Cleanup()
}
os.Exit(testRun)
}
// TestDdevStart tests the functionality that is called when "ddev start" is executed
func TestDdevStart(t *testing.T) {
assert := asrt.New(t)
app := &ddevapp.DdevApp{}
// Make sure this leaves us in the original test directory
testDir, _ := os.Getwd()
//nolint: errcheck
defer os.Chdir(testDir)
site := TestSites[0]
switchDir := site.Chdir()
defer switchDir()
runTime := util.TimeTrackC(fmt.Sprintf("%s DdevStart", site.Name))
err := app.Init(site.Dir)
assert.NoError(err)
err = app.Start()
assert.NoError(err)
t.Cleanup(func() {
err = app.Stop(true, false)
assert.NoError(err)
assert.False(dockerutil.NetworkExists("ddev-" + app.Name + "_default"))
})
// Make sure the -built Docker image exists before stop
webBuilt := ddevImages.GetWebImage() + "-" + site.Name + "-built"
dbBuilt := ddevImages.GetWebImage() + "-" + site.Name + "-built"
exists, err := dockerutil.ImageExistsLocally(webBuilt)
assert.NoError(err)
assert.True(exists)
// Ensure .ddev/.ddev-docker-compose* exists inside .ddev site folder
composeFile := fileutil.FileExists(app.DockerComposeYAMLPath())
assert.True(composeFile)
for _, containerType := range []string{"web", "db"} {
containerName, err := constructContainerName(containerType, app)
assert.NoError(err)
check, err := testcommon.ContainerCheck(containerName, "running")
assert.NoError(err)
assert.True(check, "Container check on %s failed", containerType)
}
err = app.Stop(true, false)
assert.NoError(err)
// Make sure the -built Docker images do not exist after stop with removeData
for _, imageName := range []string{webBuilt, dbBuilt} {
exists, err = dockerutil.ImageExistsLocally(imageName)
assert.NoError(err)
assert.False(exists, "image %s should not have existed but still exists (while testing %s)", imageName, app.Name)
}
runTime()
switchDir()
// Start up TestSites[0] again with a post-start hook
// When run the first time, it should execute the hook, second time it should not
err = os.Chdir(site.Dir)
assert.NoError(err)
err = app.Init(site.Dir)
app.Hooks = map[string][]ddevapp.YAMLTask{"post-start": {{"exec": "echo hello"}}}
assert.NoError(err)
stdoutFunc, err := util.CaptureOutputToFile()
assert.NoError(err)
err = app.Start()
assert.NoError(err)
t.Cleanup(func() {
err = app.Stop(true, false)
assert.NoError(err)
assert.False(dockerutil.NetworkExists("ddev-" + app.Name + "_default"))
})
out := stdoutFunc()
assert.Contains(out, "hello\n")
// Try to start a site of same name at different path
another := site
tmpDir := testcommon.CreateTmpDir("another")
copyDir := filepath.Join(tmpDir, "copy")
err = fileutil.CopyDir(site.Dir, copyDir)
assert.NoError(err)
another.Dir = copyDir
t.Cleanup(func() {
_ = os.RemoveAll(copyDir)
})
badapp := &ddevapp.DdevApp{}
err = badapp.Init(copyDir)
//nolint: errcheck
defer badapp.Stop(true, false)
if err == nil {
logs, logErr := app.CaptureLogs("web", false, "")
require.Error(t, err, "did not receive err from badapp.Init, logErr=%v, logs:\n======================= logs from app webserver =================\n%s\n============ end logs =========\n", logErr, logs)
}
if err != nil {
assert.Contains(err.Error(), fmt.Sprintf("a project (web container) in running state already exists for %s that was created at %s", TestSites[0].Name, TestSites[0].Dir))
}
// Try to start a site of same name at an equivalent but different path. It should work.
tmpDir, err = testcommon.OsTempDir()
assert.NoError(err)
symlink := filepath.Join(tmpDir, fileutil.RandomFilenameBase())
err = os.Symlink(app.AppRoot, symlink)
assert.NoError(err)
t.Cleanup(func() {
_ = os.Remove(symlink)
})
symlinkApp := &ddevapp.DdevApp{}
err = symlinkApp.Init(symlink)
assert.NoError(err)
//nolint: errcheck
defer symlinkApp.Stop(true, false)
// Make sure that GetActiveApp() also fails when trying to start app of duplicate name in current directory.
switchDir = another.Chdir()
defer switchDir()
_, err = ddevapp.GetActiveApp("")
assert.Error(err)
if err != nil {
assert.Contains(err.Error(), fmt.Sprintf("a project (web container) in running state already exists for %s that was created at %s", TestSites[0].Name, TestSites[0].Dir))
}
testcommon.CleanupDir(another.Dir)
}
// TestDdevStartCustomEntrypoint tests ddev start with customizations in .ddev/web-entrypoint.d
func TestDdevStartCustomEntrypoint(t *testing.T) {
if runtime.GOOS == "windows" &&
(globalconfig.DdevGlobalConfig.IsMutagenEnabled() ||
nodeps.PerformanceModeDefault == types.PerformanceModeMutagen) {
t.Skip("Skipping on Windows/Mutagen, it is too slow to app.Start()")
}
assert := asrt.New(t)
app := &ddevapp.DdevApp{}
site := TestSites[0]
origDir, _ := os.Getwd()
runTime := util.TimeTrackC(fmt.Sprintf("%s DdevStart", site.Name))
err := app.Init(site.Dir)
assert.NoError(err)
t.Cleanup(func() {
err = os.Chdir(origDir)
assert.NoError(err)
err = app.Stop(true, false)
assert.NoError(err)
_ = os.RemoveAll(filepath.Join(app.AppRoot, "env.php"))
_ = fileutil.PurgeDirectory(app.GetConfigPath("web-entrypoint.d"))
assert.False(dockerutil.NetworkExists("ddev-" + app.Name + "_default"))
})
r := nodeps.RandomString(10)
err = fileutil.TemplateStringToFile(fmt.Sprintf(`touch /var/tmp/%s && export TestDdevStartCustomEntrypoint=%s`, t.Name(), r), nil, app.GetConfigPath(`web-entrypoint.d/first.sh`))
require.NoError(t, err)
err = fileutil.TemplateStringToFile(`touch /var/tmp/second`, nil, app.GetConfigPath(`web-entrypoint.d/second.sh`))
require.NoError(t, err)
// See if our environment variable can be read via php-fpm
err = fileutil.TemplateStringToFile(fmt.Sprintf("<?php\n$v = getenv('%s'); echo $v;", t.Name()), nil, filepath.Join(app.AppRoot, app.Docroot, "env.php"))
require.NoError(t, err)
err = app.Start()
require.NoError(t, err)
stdout, stderr, err := app.Exec(&ddevapp.ExecOpts{
Cmd: fmt.Sprintf(`ls /var/tmp/%s >/dev/null`, t.Name()),
})
require.NoError(t, err, "stdout=%s, stderr=%s", stdout, stderr)
// Test that the environment variable that we set is now available
// via php-fpm. It is *not* available in regular shell because it
// was set in start.sh, whose shell is not inherited this way.
stdout, stderr, err = app.Exec(&ddevapp.ExecOpts{
Cmd: `curl -s --fail localhost/env.php`,
})
require.NoError(t, err, "stdout=%s, stderr=%s", stdout, stderr)
require.Equal(t, r, stdout)
stdout, stderr, err = app.Exec(&ddevapp.ExecOpts{
Cmd: `ls /var/tmp/second >/dev/null`,
})
require.NoError(t, err, "stdout=%s, stderr=%s", stdout, stderr)
runTime()
}
// TestDdevStartMultipleHostnames tests start with multiple hostnames
func TestDdevStartMultipleHostnames(t *testing.T) {
assert := asrt.New(t)
app := &ddevapp.DdevApp{}
for _, site := range TestSites {
runTime := util.TimeTrackC(fmt.Sprintf("%s DdevStartMultipleHostnames", site.Name))
testcommon.ClearDockerEnv()
err := app.Init(site.Dir)
assert.NoError(err)
// site.Name is explicitly added because if not removed in GetHostNames() it will cause ddev-router failure
// "a" is repeated for the same reason; a user error of this type should not cause a failure; GetHostNames()
// should uniqueify them.
app.AdditionalHostnames = []string{"sub1." + site.Name, "sub2." + site.Name, "subname.sub3." + site.Name, site.Name, site.Name, site.Name}
// sub1.<sitename>.ddev.site and sitename.ddev.site are deliberately included to prove they don't
// cause ddev-router failures"
// Note that these AdditionalFQDNs require sudo privileges, which the test runners
// don't typically have.
app.AdditionalFQDNs = []string{"one.example.com", "two.example.com", "a.one.example.com", site.Name + "." + app.ProjectTLD, "sub1." + site.Name + "." + app.ProjectTLD}
err = app.WriteConfig()
assert.NoError(err)
err = app.StartAndWait(5)
require.NoError(t, err)
if err != nil && strings.Contains(err.Error(), "db container failed") {
container, err := app.FindContainerByType("db")
assert.NoError(err)
out, err := exec.RunHostCommand("docker", "logs", container.Names[0])
assert.NoError(err)
t.Logf("DB Logs after app.Start: \n%s\n== END DB LOGS ==", out)
}
// Ensure .ddev/docker-compose*.yaml exists inside .ddev site folder
composeFile := fileutil.FileExists(app.DockerComposeYAMLPath())
assert.True(composeFile)
for _, containerType := range []string{"web", "db"} {
containerName, err := constructContainerName(containerType, app)
assert.NoError(err)
check, err := testcommon.ContainerCheck(containerName, "running")
assert.NoError(err)
assert.True(check, "Container check on %s failed", containerType)
}
httpURLs, _, urls := app.GetAllURLs()
if globalconfig.GetCAROOT() == "" {
urls = httpURLs
}
t.Logf("Testing these URLs: %v", urls)
for _, url := range urls {
_, _ = testcommon.EnsureLocalHTTPContent(t, url+site.Safe200URIWithExpectation.URI, site.Safe200URIWithExpectation.Expect)
}
// Multiple projects can't run at the same time with the fqdns, so we need to clean
// up these for tests that run later.
app.AdditionalFQDNs = []string{}
app.AdditionalHostnames = []string{}
err = app.WriteConfig()
assert.NoError(err)
err = app.Stop(true, false)
assert.NoError(err)
runTime()
}
}
// TestDdevStartUnmanagedSettings start and config with disable_settings_management
func TestDdevStartUnmanagedSettings(t *testing.T) {
if nodeps.PerformanceModeDefault == types.PerformanceModeMutagen ||
globalconfig.DdevGlobalConfig.IsMutagenEnabled() ||
nodeps.NoBindMountsDefault {
t.Skip("Skipping with Mutagen because conflict on settings files")
}
assert := asrt.New(t)
// Make sure this leaves us in the original test directory
origDir, _ := os.Getwd()
// Use Drupal9 as it is a good target for Composer failures
site := FullTestSites[8]
// We will create directory from scratch, as we'll be removing files and changing it.
app := &ddevapp.DdevApp{Name: site.Name}
_ = app.Stop(true, false)
_ = globalconfig.RemoveProjectInfo(site.Name)
err := site.Prepare()
require.NoError(t, err)
err = app.Init(site.Dir)
assert.NoError(err)
t.Cleanup(func() {
err = os.Chdir(origDir)
assert.NoError(err)
_ = app.Stop(true, false)
_ = os.RemoveAll(site.Dir)
})
err = os.Chdir(app.AppRoot)
assert.NoError(err)
// Previous tests may have left settings files
_ = os.Remove(app.SiteSettingsPath)
_ = os.Remove(app.SiteDdevSettingsFile)
app.DisableSettingsManagement = true
err = app.WriteConfig()
assert.NoError(err)
// After config, they should still not exist, because we had DisableSettingsManagement
assert.False(fileutil.FileExists(app.SiteSettingsPath))
assert.False(fileutil.FileExists(app.SiteDdevSettingsFile))
err = app.Start()
assert.NoError(err)
// After start, they should still not exist, because we had DisableSettingsManagement
assert.False(fileutil.FileExists(app.SiteSettingsPath))
assert.False(fileutil.FileExists(app.SiteDdevSettingsFile))
err = app.Stop(false, false)
assert.NoError(err)
app.DisableSettingsManagement = false
err = app.WriteConfig()
assert.NoError(err)
_, err = app.CreateSettingsFile()
assert.NoError(err)
err = app.Start()
assert.NoError(err)
// Now with DisableSettingsManagement=false, both should exist after config/settings creation
assert.FileExists(app.SiteSettingsPath)
assert.FileExists(app.SiteDdevSettingsFile)
err = os.Remove(filepath.Join(app.SiteSettingsPath))
assert.NoError(err)
err = os.Remove(filepath.Join(app.SiteDdevSettingsFile))
assert.NoError(err)
// Flush to prevent conflict with Mutagen holding file below
err = app.MutagenSyncFlush()
assert.NoError(err)
assert.False(fileutil.FileExists(app.SiteSettingsPath))
assert.False(fileutil.FileExists(app.SiteDdevSettingsFile))
err = app.Start()
assert.NoError(err)
// Now with DisableSettingsManagement=false, start should have created both
assert.FileExists(app.SiteSettingsPath)
assert.FileExists(app.SiteDdevSettingsFile)
}
// TestDdevNoProjectMount tests running without the app file mount.
func TestDdevNoProjectMount(t *testing.T) {
assert := asrt.New(t)
app := &ddevapp.DdevApp{}
// Make sure this leaves us in the original test directory
testDir, _ := os.Getwd()
//nolint: errcheck
defer os.Chdir(testDir)
site := TestSites[0]
switchDir := site.Chdir()
defer switchDir()
defer util.TimeTrackC(fmt.Sprintf("%s %s", t.Name(), site.Name))()
err := app.Init(site.Dir)
assert.NoError(err)
if app.IsMutagenEnabled() || nodeps.NoBindMountsDefault {
t.Skip("Skipping because this doesn't make sense with Mutagen or NoBindMounts")
}
app.NoProjectMount = true
err = app.WriteConfig()
assert.NoError(err)
defer func() {
err = app.Stop(true, false)
assert.NoError(err)
app.NoProjectMount = false
err = app.WriteConfig()
assert.NoError(err)
}()
err = app.Restart()
assert.NoError(err)
stdout, _, err := app.Exec(&ddevapp.ExecOpts{
Service: "web",
Dir: "/var/www/html",
Cmd: `findmnt -T /var/www/html | awk '$1 != "TARGET" {printf $1}'`,
})
assert.NoError(err)
assert.NotEqual("/var/www/html", stdout)
}
// TestDdevXdebugEnabled tests running with xdebug_enabled = true, etc.
func TestDdevXdebugEnabled(t *testing.T) {
if (dockerutil.IsColima() || dockerutil.IsLima()) && os.Getenv("DDEV_TEST_COLIMA_ANYWAY") != "true" {
t.Skip("Skipping on Lima/Colima because this test doesn't work although manual testing works")
}
if nodeps.IsWSL2() && dockerutil.IsDockerDesktop() {
t.Skip("Skipping on WSL2/Docker Desktop because this test doesn't work although manual testing works")
}
assert := asrt.New(t)
origDir, _ := os.Getwd()
app := &ddevapp.DdevApp{}
testcommon.ClearDockerEnv()
// On macOS we want to listen on localhost port, to not trigger
// a firewall block. On other systems, we listen on all interfaces.
listenPort := ":9003"
if runtime.GOOS == "darwin" {
listenPort = "127.0.0.1:9003"
}
projDir := testcommon.CreateTmpDir(t.Name())
app, err := ddevapp.NewApp(projDir, false)
require.NoError(t, err)
app.Type = nodeps.AppTypePHP
err = app.WriteConfig()
require.NoError(t, err)
// Create the simplest possible PHP file; outputs PHP_IDE_CONFIG value
// Which should be empty.
err = fileutil.TemplateStringToFile("<?php\nif (getenv('PHP_IDE_CONFIG') === false) { echo 'PHP_IDE_CONFIG is properly unset'; } else { echo 'PHP_IDE_CONFIG is set'; }\n", nil, filepath.Join(app.AppRoot, "index.php"))
require.NoError(t, err)
// If using wsl2-docker-inside, test that we can use IDE inside
// Unfortunately, this does not test for the common case where the IDE is running on Windows.
if nodeps.IsWSL2() && !dockerutil.IsDockerDesktop() {
globalconfig.DdevGlobalConfig.XdebugIDELocation = globalconfig.XdebugIDELocationWSL2
}
t.Cleanup(func() {
err = app.Stop(true, false)
assert.NoError(err)
err := os.Chdir(origDir)
assert.NoError(err)
_ = os.RemoveAll(projDir)
globalconfig.DdevGlobalConfig.XdebugIDELocation = ""
_ = globalconfig.WriteGlobalConfig(globalconfig.DdevGlobalConfig)
})
runTime := util.TimeTrackC(fmt.Sprintf("%s %s", app.Name, t.Name()))
_ = os.Chdir(app.AppRoot)
testcommon.ClearDockerEnv()
// Most of the time there's no reason to do all versions of PHP
phpKeys := []string{}
exclusions := []string{"5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0"}
for k := range nodeps.ValidPHPVersions {
if os.Getenv("GOTEST_SHORT") != "" && !nodeps.ArrayContainsString(exclusions, k) {
phpKeys = append(phpKeys, k)
}
}
sort.Strings(phpKeys)
// Most of the time we can just test with the default PHP version
if os.Getenv("GOTEST_SHORT") != "" {
phpKeys = []string{nodeps.PHPDefault}
}
for _, v := range phpKeys {
app.PHPVersion = v
t.Logf("Beginning XDebug checks with XDebug php%s\n", v)
err = app.Restart()
require.NoError(t, err)
// Make sure that PHP_IDE_CONFIG did not get accidentally set, which
// will cause PhpStorm, etc not to auto-configure properly.
stdout, _, err := app.Exec(&ddevapp.ExecOpts{
Cmd: "curl -sSfL localhost",
})
require.NoError(t, err)
require.Equal(t, `PHP_IDE_CONFIG is properly unset`, stdout)
opts := &ddevapp.ExecOpts{
Service: "web",
Cmd: "php --ri xdebug",
}
stdout, _, err = app.Exec(opts)
assert.Error(err)
assert.Contains(stdout, "Extension 'xdebug' not present")
// Run with Xdebug enabled
_, _, err = app.Exec(&ddevapp.ExecOpts{
Cmd: "enable_xdebug",
})
assert.NoError(err)