Skip to content

Use existing Windows image for test instead of microsoft/nanoserver#39095

Merged
cpuguy83 merged 1 commit intomoby:masterfrom
StefanScherer:fix-TestPullWindowsImageFailsOnLinux
Apr 17, 2019
Merged

Use existing Windows image for test instead of microsoft/nanoserver#39095
cpuguy83 merged 1 commit intomoby:masterfrom
StefanScherer:fix-TestPullWindowsImageFailsOnLinux

Conversation

@StefanScherer
Copy link
Contributor

@StefanScherer StefanScherer commented Apr 17, 2019

- What I did

Fix the test TestPullWindowsImageFailsOnLinux as the latest tag is no longer available as seen in https://jenkins.dockerproject.org/job/Docker-PRs/53794/console
Also improve the tests to check no matching manifest for ... does not contain unknown.

- How I did it

- How to verify it

make test-integration

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

the animal is invisible as the latest tag

@StefanScherer StefanScherer force-pushed the fix-TestPullWindowsImageFailsOnLinux branch from 778168f to a147d83 Compare April 17, 2019 10:20
@codecov
Copy link

codecov bot commented Apr 17, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@1742b9d). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master   #39095   +/-   ##
=========================================
  Coverage          ?   36.99%           
=========================================
  Files             ?      612           
  Lines             ?    45390           
  Branches          ?        0           
=========================================
  Hits              ?    16794           
  Misses            ?    26317           
  Partials          ?     2279

@StefanScherer StefanScherer changed the title Use microsoft/nanoserver:sac2016 instead of latest Use existing Windows image for test instead of microsoft/nanoserver Apr 17, 2019
@StefanScherer
Copy link
Contributor Author

Updated the test to the ltsc2019 servercore image which should exist for a long time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this produce the other error though?

moby/distribution/config.go

Lines 154 to 160 in fc01c2b

// fail immediately on Windows when downloading a non-Windows image
// and vice versa. Exception on Windows if Linux Containers are enabled.
if runtime.GOOS == "windows" && unmarshalledConfig.OS == "linux" && !system.LCOWSupported() {
return nil, fmt.Errorf("image operating system %q cannot be used on this platform", unmarshalledConfig.OS)
} else if runtime.GOOS != "windows" && unmarshalledConfig.OS == "windows" {
return nil, fmt.Errorf("image operating system %q cannot be used on this platform", unmarshalledConfig.OS)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually shows this error when the image in the registry is a manifest list.

errMsg := fmt.Sprintf("no matching manifest for %s in the manifest list entries", formatPlatform(platform))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... looks like a bug in that detection then; wondering: could we fix that?
Was the previous image not multi-arch?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually; for this test we're only checking that the pull fails, so I guess it's ok (we might want to check for no matching manifest for linux perhaps?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent idea so we don't need a new test for #38574 :-)
I'll add it, but also the no matching manifest for windows in the corresponding test for Windows.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

testRequires(c, DaemonIsLinux, Network)
_, _, err := dockerCmdWithError("pull", "microsoft/nanoserver")
assert.ErrorContains(c, err, "cannot be used on this platform")
_, _, err := dockerCmdWithError("pull", "mcr.microsoft.com/windows/servercore:ltsc2019")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I try this with docker-ce 19.03.0-beta1 on a linux machine:

$ docker pull mcr.microsoft.com/windows/servercore:ltsc2019
ltsc2019: Pulling from windows/servercore
no matching manifest for linux/amd64 in the manifest list entries

However, when I try this on docker for mac with docker-ce 18.09.3 engine:

$ docker pull mcr.microsoft.com/windows/servercore:ltsc2019
ltsc2019: Pulling from windows/servercore
no matching manifest for unknown in the manifest list entries

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR is good to go if expecting the arch in the error message is the right thing to expect.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing the same on Docker for Mac, so looks like there might be an issue there (or perhaps something we fixed since?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #38574 that fixes that unknown message doesn't have a 18.09 tag, so it comes with 19.03

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right! I knew there was one; let me have a look at backporting it to 18.09

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backport is up; docker-archive#197

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM... though it may be nice to have a fake non-matching image in a local registry...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants