From 6fe12b3fb5d3527a66c7b83e1e8b7643bab7ef9d Mon Sep 17 00:00:00 2001 From: James Shubin Date: Thu, 8 Jun 2017 00:28:16 -0400 Subject: [PATCH] resources: Compare grouped resources properly When comparing resources, we have to recursively compare grouped resources as well! Now fixed. --- resources/resources.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/resources/resources.go b/resources/resources.go index ce3d4cec..757b5ec2 100644 --- a/resources/resources.go +++ b/resources/resources.go @@ -529,6 +529,19 @@ func (obj *BaseRes) Compare(res Res) bool { if !cmpSlices(obj.Meta().Sema, res.Meta().Sema) { return false } + + // if resources are grouped, are the groups the same? + if i, j := obj.GetGroup(), res.GetGroup(); len(i) != len(j) { + return false + } else { + ix, jx := Sort(i), Sort(j) + for k := range ix { + if !ix[k].Compare(jx[k]) { // compare sub resources + return false + } + } + } + return true }