Do comparison of replicasets, but apply a function first to be able to exclude (reset) some values
(before, after ReplicationSet, exclude func(*InstanceDesc))
| 170 | // Do comparison of replicasets, but apply a function first |
| 171 | // to be able to exclude (reset) some values |
| 172 | func hasReplicationSetChangedExcluding(before, after ReplicationSet, exclude func(*InstanceDesc)) bool { |
| 173 | beforeInstances := before.Instances |
| 174 | afterInstances := after.Instances |
| 175 | |
| 176 | if len(beforeInstances) != len(afterInstances) { |
| 177 | return true |
| 178 | } |
| 179 | |
| 180 | sort.Sort(ByAddr(beforeInstances)) |
| 181 | sort.Sort(ByAddr(afterInstances)) |
| 182 | |
| 183 | for i := range beforeInstances { |
| 184 | b := beforeInstances[i] |
| 185 | a := afterInstances[i] |
| 186 | |
| 187 | exclude(&a) |
| 188 | exclude(&b) |
| 189 | |
| 190 | if !b.Equal(a) { |
| 191 | return true |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | return false |
| 196 | } |
no test coverage detected