MCPcopy Create free account
hub / github.com/cortexproject/cortex / compareReplicationSets

Function compareReplicationSets

pkg/ring/ring_test.go:2933–2947  ·  view source on GitHub ↗

compareReplicationSets returns the list of instance addresses which differ between the two sets.

(first, second ReplicationSet)

Source from the content-addressed store, hash-verified

2931
2932// compareReplicationSets returns the list of instance addresses which differ between the two sets.
2933func compareReplicationSets(first, second ReplicationSet) (added, removed []string) {
2934 for _, instance := range first.Instances {
2935 if !second.Includes(instance.Addr) {
2936 added = append(added, instance.Addr)
2937 }
2938 }
2939
2940 for _, instance := range second.Instances {
2941 if !first.Includes(instance.Addr) {
2942 removed = append(removed, instance.Addr)
2943 }
2944 }
2945
2946 return
2947}
2948
2949// This test verifies that ring is getting updates, even after extending check in the loop method.
2950func TestRingUpdates(t *testing.T) {

Callers 1

Calls 1

IncludesMethod · 0.80

Tested by

no test coverage detected