Skip to content

Commit 2c3dfde

Browse files
committed
test: Use daemon OS instead of runtime OS in PullNever test
This fixes test failures on Windows runners running Linux containers. The test was using runtime.GOOS which returns 'windows' on Windows hosts, but the Docker daemon may be running Linux containers. Now we use the daemon's actual OS type queried via docker.Info(). Signed-off-by: Juan Bustamante <bustamantejj@gmail.com>
1 parent 3db739d commit 2c3dfde

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

pkg/image/fetcher_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,8 +741,10 @@ func testFetcher(t *testing.T, when spec.G, it spec.S) {
741741
localImageName = "pack.local/test-" + h.RandString(10)
742742

743743
// Create a local daemon image with platform information
744+
// Use osType (daemon OS) instead of runtime.GOOS to handle cases where
745+
// Windows runner is running Linux containers
744746
img, err := local.NewImage(localImageName, docker, local.WithDefaultPlatform(imgutil.Platform{
745-
OS: runtime.GOOS,
747+
OS: osType,
746748
Architecture: runtime.GOARCH,
747749
}))
748750
h.AssertNil(t, err)
@@ -755,7 +757,7 @@ func testFetcher(t *testing.T, when spec.G, it spec.S) {
755757

756758
it("skips platform-specific digest resolution and uses tag directly", func() {
757759
target := dist.Target{
758-
OS: runtime.GOOS,
760+
OS: osType,
759761
Arch: runtime.GOARCH,
760762
}
761763

0 commit comments

Comments
 (0)