Update snapshot parent filter property to always exist

The parent property may be empty but always exists.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan 2019-10-31 17:18:14 -07:00
parent 383f4a77ee
commit d1261b5087
No known key found for this signature in database
GPG Key ID: F58C5D0A4405ACDB
3 changed files with 3 additions and 7 deletions

View File

@ -159,9 +159,7 @@ func adaptSnapshot(info snapshots.Info) filters.Adaptor {
case "name":
return info.Name, true
case "parent":
if info.Parent != "" {
return info.Parent, true
}
return info.Parent, true
case "labels":
return checkMap(fieldpath[1:], info.Labels)
}

View File

@ -633,9 +633,7 @@ func adaptSnapshot(info snapshots.Info) filters.Adaptor {
case "name":
return info.Name, true
case "parent":
if info.Parent != "" {
return info.Parent, true
}
return info.Parent, true
case "labels":
if len(info.Labels) == 0 {
return "", false

View File

@ -1061,7 +1061,7 @@ func checkWalk(ctx context.Context, t *testing.T, snapshotter snapshots.Snapshot
},
{
matches: []string{"a", "v", "a-wl", "v-wl"},
filters: []string{"parent,labels.\"containerd.io/gc.root\"==check-walk"},
filters: []string{"parent!=\"\",labels.\"containerd.io/gc.root\"==check-walk"},
},
{
matches: []string{"p-wl", "a-wl", "v-wl", "a-np-wl"},