@@ -584,7 +584,6 @@ func testExportBusyboxLocal(t *testing.T, sb integration.Sandbox) {
584
584
}
585
585
586
586
func testHostnameLookup (t * testing.T , sb integration.Sandbox ) {
587
- integration .SkipOnPlatform (t , "windows" )
588
587
if sb .Rootless () { // bridge is not used by default, even with detach-netns
589
588
t .SkipNow ()
590
589
}
@@ -593,7 +592,12 @@ func testHostnameLookup(t *testing.T, sb integration.Sandbox) {
593
592
require .NoError (t , err )
594
593
defer c .Close ()
595
594
596
- st := llb .Image ("busybox:latest" ).Run (llb .Shlex (`sh -c "ping -c 1 $(hostname)"` ))
595
+ imgName := integration .UnixOrWindows ("busybox:latest" , "nanoserver:latest" )
596
+ cmdStr := integration .UnixOrWindows (
597
+ `sh -c "ping -c 1 $(hostname)"` ,
598
+ "cmd /C ping -n 1 %COMPUTERNAME%" ,
599
+ )
600
+ st := llb .Image (imgName ).Run (llb .Shlex (cmdStr ))
597
601
598
602
def , err := st .Marshal (sb .Context ())
599
603
require .NoError (t , err )
@@ -604,7 +608,6 @@ func testHostnameLookup(t *testing.T, sb integration.Sandbox) {
604
608
605
609
// moby/buildkit#1301
606
610
func testHostnameSpecifying (t * testing.T , sb integration.Sandbox ) {
607
- integration .SkipOnPlatform (t , "windows" )
608
611
if sb .Rootless () { // bridge is not used by default, even with detach-netns
609
612
t .SkipNow ()
610
613
}
@@ -614,9 +617,21 @@ func testHostnameSpecifying(t *testing.T, sb integration.Sandbox) {
614
617
defer c .Close ()
615
618
616
619
hostname := "testtest"
617
- st := llb .Image ("busybox:latest" ).With (llb .Hostname (hostname )).
618
- Run (llb .Shlexf ("sh -c 'echo $HOSTNAME | grep %s'" , hostname )).
619
- Run (llb .Shlexf ("sh -c 'echo $(hostname) | grep %s'" , hostname ))
620
+ // NOTE: Windows capitalizes the hostname hence
621
+ // case insensitive findstr (findstr /I)
622
+ // testtest --> TESTTEST
623
+ cmdStr1 := integration .UnixOrWindows (
624
+ "sh -c 'echo $HOSTNAME | grep %s'" ,
625
+ "cmd /C echo %%COMPUTERNAME%% | findstr /I %s" ,
626
+ )
627
+ cmdStr2 := integration .UnixOrWindows (
628
+ "sh -c 'echo $(hostname) | grep %s'" ,
629
+ "cmd /C echo %%COMPUTERNAME%% | findstr /I %s" ,
630
+ )
631
+ imgName := integration .UnixOrWindows ("busybox:latest" , "nanoserver:latest" )
632
+ st := llb .Image (imgName ).With (llb .Hostname (hostname )).
633
+ Run (llb .Shlexf (cmdStr1 , hostname )).
634
+ Run (llb .Shlexf (cmdStr2 , hostname ))
620
635
621
636
def , err := st .Marshal (sb .Context ())
622
637
require .NoError (t , err )
@@ -629,12 +644,13 @@ func testHostnameSpecifying(t *testing.T, sb integration.Sandbox) {
629
644
630
645
// moby/buildkit#614
631
646
func testStdinClosed (t * testing.T , sb integration.Sandbox ) {
632
- integration .SkipOnPlatform (t , "windows" )
633
647
c , err := New (sb .Context (), sb .Address ())
634
648
require .NoError (t , err )
635
649
defer c .Close ()
636
650
637
- st := llb .Image ("busybox:latest" ).Run (llb .Shlex ("cat" ))
651
+ imgName := integration .UnixOrWindows ("busybox:latest" , "nanoserver:latest" )
652
+ cmdStr := integration .UnixOrWindows ("cat" , "cmd /C more" )
653
+ st := llb .Image (imgName ).Run (llb .Shlex (cmdStr ))
638
654
639
655
def , err := st .Marshal (sb .Context ())
640
656
require .NoError (t , err )
@@ -1186,7 +1202,6 @@ func testSecurityModeErrors(t *testing.T, sb integration.Sandbox) {
1186
1202
}
1187
1203
1188
1204
func testFrontendImageNaming (t * testing.T , sb integration.Sandbox ) {
1189
- requiresLinux (t )
1190
1205
c , err := New (sb .Context (), sb .Address ())
1191
1206
require .NoError (t , err )
1192
1207
defer c .Close ()
@@ -1918,7 +1933,6 @@ func testFileOpCopyIncludeExclude(t *testing.T, sb integration.Sandbox) {
1918
1933
}
1919
1934
1920
1935
func testFileOpCopyAlwaysReplaceExistingDestPaths (t * testing.T , sb integration.Sandbox ) {
1921
- requiresLinux (t )
1922
1936
c , err := New (sb .Context (), sb .Address ())
1923
1937
require .NoError (t , err )
1924
1938
defer c .Close ()
@@ -1993,7 +2007,6 @@ func testFileOpCopyAlwaysReplaceExistingDestPaths(t *testing.T, sb integration.S
1993
2007
1994
2008
// testFileOpInputSwap is a regression test that cache is invalidated when subset of fileop is built
1995
2009
func testFileOpInputSwap (t * testing.T , sb integration.Sandbox ) {
1996
- requiresLinux (t )
1997
2010
c , err := New (sb .Context (), sb .Address ())
1998
2011
require .NoError (t , err )
1999
2012
defer c .Close ()
@@ -2018,7 +2031,11 @@ func testFileOpInputSwap(t *testing.T, sb integration.Sandbox) {
2018
2031
2019
2032
_ , err = c .Solve (sb .Context (), def , SolveOpt {}, nil )
2020
2033
require .Error (t , err )
2021
- require .Contains (t , err .Error (), "bar: no such file" )
2034
+ errStr := integration .UnixOrWindows (
2035
+ "bar: no such file" ,
2036
+ "bar: The system cannot find the file specified" ,
2037
+ )
2038
+ require .Contains (t , err .Error (), errStr )
2022
2039
}
2023
2040
2024
2041
func testLocalSourceDiffer (t * testing.T , sb integration.Sandbox ) {
@@ -2030,7 +2047,6 @@ func testLocalSourceDiffer(t *testing.T, sb integration.Sandbox) {
2030
2047
}
2031
2048
2032
2049
func testLocalSourceWithDiffer (t * testing.T , sb integration.Sandbox , d llb.DiffType ) {
2033
- requiresLinux (t )
2034
2050
c , err := New (context .TODO (), sb .Address ())
2035
2051
require .NoError (t , err )
2036
2052
defer c .Close ()
@@ -2628,7 +2644,6 @@ func testBuildExportScratch(t *testing.T, sb integration.Sandbox) {
2628
2644
}
2629
2645
2630
2646
func testBuildHTTPSource (t * testing.T , sb integration.Sandbox ) {
2631
- integration .SkipOnPlatform (t , "windows" )
2632
2647
c , err := New (sb .Context (), sb .Address ())
2633
2648
require .NoError (t , err )
2634
2649
defer c .Close ()
@@ -2738,8 +2753,11 @@ func testBuildHTTPSource(t *testing.T, sb integration.Sandbox) {
2738
2753
require .Equal (t , "gzip" , allReqs [3 ].Header .Get ("Accept-Encoding" ))
2739
2754
2740
2755
// test extra options
2741
- st = llb .HTTP (server .URL + "/foo" , llb .Filename ("bar" ), llb .Chmod (0741 ), llb .Chown (1000 , 1000 ))
2742
-
2756
+ // llb.Chown not supported on Windows
2757
+ st = integration .UnixOrWindows (
2758
+ llb .HTTP (server .URL + "/foo" , llb .Filename ("bar" ), llb .Chmod (0741 ), llb .Chown (1000 , 1000 )),
2759
+ llb .HTTP (server .URL + "/foo" , llb .Filename ("bar" ), llb .Chmod (0741 )),
2760
+ )
2743
2761
def , err = st .Marshal (sb .Context ())
2744
2762
require .NoError (t , err )
2745
2763
@@ -2763,7 +2781,10 @@ func testBuildHTTPSource(t *testing.T, sb integration.Sandbox) {
2763
2781
fi , err := os .Stat (filepath .Join (tmpdir , "bar" ))
2764
2782
require .NoError (t , err )
2765
2783
require .Equal (t , fi .ModTime ().Format (http .TimeFormat ), modTime .Format (http .TimeFormat ))
2766
- require .Equal (t , 0741 , int (fi .Mode ()& 0777 ))
2784
+
2785
+ // no support for llb.Chmod on Windows, default is returned
2786
+ fMode := integration .UnixOrWindows (0741 , 0666 )
2787
+ require .Equal (t , fMode , int (fi .Mode ()& 0777 ))
2767
2788
2768
2789
checkAllReleasable (t , c , sb , true )
2769
2790
@@ -2772,7 +2793,6 @@ func testBuildHTTPSource(t *testing.T, sb integration.Sandbox) {
2772
2793
2773
2794
// docker/buildx#2803
2774
2795
func testBuildHTTPSourceEtagScope (t * testing.T , sb integration.Sandbox ) {
2775
- integration .SkipOnPlatform (t , "windows" )
2776
2796
c , err := New (sb .Context (), sb .Address ())
2777
2797
require .NoError (t , err )
2778
2798
defer c .Close ()
@@ -3304,12 +3324,16 @@ func testOCIExporterContentStore(t *testing.T, sb integration.Sandbox) {
3304
3324
3305
3325
func testNoTarOCIIndexMediaType (t * testing.T , sb integration.Sandbox ) {
3306
3326
workers .CheckFeatureCompat (t , sb , workers .FeatureOCIExporter )
3307
- requiresLinux (t )
3308
3327
c , err := New (sb .Context (), sb .Address ())
3309
3328
require .NoError (t , err )
3310
3329
defer c .Close ()
3311
3330
3312
- st := llb .Image ("busybox:latest" ).Run (llb .Shlex (`sh -c "echo -n hello > hello"` ))
3331
+ imgName := integration .UnixOrWindows ("busybox:latest" , "nanoserver:latest" )
3332
+ cmdStr := integration .UnixOrWindows (
3333
+ `sh -c "echo -n hello > hello"` ,
3334
+ `cmd /C "echo hello> hello"` ,
3335
+ )
3336
+ st := llb .Image (imgName ).Run (llb .Shlex (cmdStr ))
3313
3337
def , err := st .Marshal (sb .Context ())
3314
3338
require .NoError (t , err )
3315
3339
@@ -3347,12 +3371,16 @@ func testNoTarOCIIndexMediaType(t *testing.T, sb integration.Sandbox) {
3347
3371
3348
3372
func testOCIIndexMediatype (t * testing.T , sb integration.Sandbox ) {
3349
3373
workers .CheckFeatureCompat (t , sb , workers .FeatureOCIExporter )
3350
- requiresLinux (t )
3351
3374
c , err := New (sb .Context (), sb .Address ())
3352
3375
require .NoError (t , err )
3353
3376
defer c .Close ()
3354
3377
3355
- st := llb .Image ("busybox:latest" ).Run (llb .Shlex (`sh -c "echo -n hello > hello"` ))
3378
+ imgName := integration .UnixOrWindows ("busybox:latest" , "nanoserver:latest" )
3379
+ cmdStr := integration .UnixOrWindows (
3380
+ `sh -c "echo -n hello > hello"` ,
3381
+ `cmd /C "echo hello> hello"` ,
3382
+ )
3383
+ st := llb .Image (imgName ).Run (llb .Shlex (cmdStr ))
3356
3384
def , err := st .Marshal (sb .Context ())
3357
3385
require .NoError (t , err )
3358
3386
@@ -3798,7 +3826,6 @@ func testSourceDateEpochImageExporter(t *testing.T, sb integration.Sandbox) {
3798
3826
}
3799
3827
3800
3828
func testFrontendMetadataReturn (t * testing.T , sb integration.Sandbox ) {
3801
- requiresLinux (t )
3802
3829
c , err := New (sb .Context (), sb .Address ())
3803
3830
require .NoError (t , err )
3804
3831
defer c .Close ()
@@ -3839,7 +3866,6 @@ func testFrontendMetadataReturn(t *testing.T, sb integration.Sandbox) {
3839
3866
}
3840
3867
3841
3868
func testFrontendUseSolveResults (t * testing.T , sb integration.Sandbox ) {
3842
- requiresLinux (t )
3843
3869
c , err := New (sb .Context (), sb .Address ())
3844
3870
require .NoError (t , err )
3845
3871
defer c .Close ()
@@ -3904,12 +3930,12 @@ func testFrontendUseSolveResults(t *testing.T, sb integration.Sandbox) {
3904
3930
3905
3931
func testExporterTargetExists (t * testing.T , sb integration.Sandbox ) {
3906
3932
workers .CheckFeatureCompat (t , sb , workers .FeatureOCIExporter )
3907
- requiresLinux (t )
3908
3933
c , err := New (sb .Context (), sb .Address ())
3909
3934
require .NoError (t , err )
3910
3935
defer c .Close ()
3911
3936
3912
- st := llb .Image ("busybox:latest" )
3937
+ imgName := integration .UnixOrWindows ("busybox:latest" , "nanoserver:latest" )
3938
+ st := llb .Image (imgName )
3913
3939
def , err := st .Marshal (sb .Context ())
3914
3940
require .NoError (t , err )
3915
3941
@@ -5229,7 +5255,6 @@ func testStargzLazyPull(t *testing.T, sb integration.Sandbox) {
5229
5255
5230
5256
func testLazyImagePush (t * testing.T , sb integration.Sandbox ) {
5231
5257
workers .CheckFeatureCompat (t , sb , workers .FeatureDirectPush )
5232
- requiresLinux (t )
5233
5258
cdAddress := sb .ContainerdAddress ()
5234
5259
if cdAddress == "" {
5235
5260
t .Skip ("test requires containerd worker" )
@@ -5252,7 +5277,7 @@ func testLazyImagePush(t *testing.T, sb integration.Sandbox) {
5252
5277
defer c .Close ()
5253
5278
5254
5279
// push the busybox image to the mutable registry
5255
- sourceImage := "busybox:latest"
5280
+ sourceImage := integration . UnixOrWindows ( "busybox:latest" , "nanoserver:latest" )
5256
5281
def , err := llb .Image (sourceImage ).Marshal (sb .Context ())
5257
5282
require .NoError (t , err )
5258
5283
@@ -5359,7 +5384,8 @@ func testLazyImagePush(t *testing.T, sb integration.Sandbox) {
5359
5384
}
5360
5385
5361
5386
// check that a subsequent build can use the previously lazy image in an exec
5362
- def , err = llb .Image (target2 ).Run (llb .Args ([]string {"true" })).Marshal (sb .Context ())
5387
+ cmdStr := integration .UnixOrWindows ("true" , "cmd /C exit 0" )
5388
+ def , err = llb .Image (target2 ).Run (llb .Args ([]string {cmdStr })).Marshal (sb .Context ())
5363
5389
require .NoError (t , err )
5364
5390
5365
5391
_ , err = c .Solve (sb .Context (), def , SolveOpt {}, nil )
@@ -6104,8 +6130,6 @@ func testBasicGhaCacheImportExportExtraTimeout(t *testing.T, sb integration.Sand
6104
6130
}
6105
6131
6106
6132
func testRegistryEmptyCacheExport (t * testing.T , sb integration.Sandbox ) {
6107
- requiresLinux (t )
6108
-
6109
6133
workers .CheckFeatureCompat (t , sb ,
6110
6134
workers .FeatureCacheExport ,
6111
6135
workers .FeatureCacheBackendRegistry ,
@@ -6371,7 +6395,6 @@ func testSnapshotWithMultipleBlobs(t *testing.T, sb integration.Sandbox) {
6371
6395
}
6372
6396
6373
6397
func testExportLocalNoPlatformSplit (t * testing.T , sb integration.Sandbox ) {
6374
- integration .SkipOnPlatform (t , "windows" )
6375
6398
workers .CheckFeatureCompat (t , sb , workers .FeatureOCIExporter , workers .FeatureMultiPlatform )
6376
6399
c , err := New (sb .Context (), sb .Address ())
6377
6400
require .NoError (t , err )
@@ -6449,7 +6472,6 @@ func testExportLocalNoPlatformSplit(t *testing.T, sb integration.Sandbox) {
6449
6472
}
6450
6473
6451
6474
func testExportLocalNoPlatformSplitOverwrite (t * testing.T , sb integration.Sandbox ) {
6452
- integration .SkipOnPlatform (t , "windows" )
6453
6475
workers .CheckFeatureCompat (t , sb , workers .FeatureOCIExporter , workers .FeatureMultiPlatform )
6454
6476
c , err := New (sb .Context (), sb .Address ())
6455
6477
require .NoError (t , err )
@@ -6999,7 +7021,6 @@ func testMoveParentDir(t *testing.T, sb integration.Sandbox) {
6999
7021
7000
7022
// #296
7001
7023
func testSchema1Image (t * testing.T , sb integration.Sandbox ) {
7002
- integration .SkipOnPlatform (t , "windows" )
7003
7024
c , err := New (sb .Context (), sb .Address ())
7004
7025
require .NoError (t , err )
7005
7026
defer c .Close ()
@@ -7127,7 +7148,6 @@ func testSourceMap(t *testing.T, sb integration.Sandbox) {
7127
7148
}
7128
7149
7129
7150
func testSourceMapFromRef (t * testing.T , sb integration.Sandbox ) {
7130
- requiresLinux (t )
7131
7151
c , err := New (sb .Context (), sb .Address ())
7132
7152
require .NoError (t , err )
7133
7153
defer c .Close ()
0 commit comments