test: Check manifest.Platform before dereferencing

If the registry returns a manifest without platform info, the
`manifest.Platform` will be `nil` and cause panic when dereferencing.

Signed-off-by: Li Yuxuan <liyuxuan04@baidu.com>
This commit is contained in:
Li Yuxuan 2019-07-22 20:36:24 +08:00
parent f58fda97ec
commit 5e5ae23d80

View File

@ -293,6 +293,9 @@ func TestImagePullSomePlatforms(t *testing.T) {
found := false found := false
for _, matcher := range m { for _, matcher := range m {
if manifest.Platform == nil {
t.Fatal("manifest should have proper platform")
}
if matcher.Match(*manifest.Platform) { if matcher.Match(*manifest.Platform) {
count++ count++
found = true found = true