diff --git a/probe/plugins/registry.go b/probe/plugins/registry.go index 202f47620..132dda94e 100644 --- a/probe/plugins/registry.go +++ b/probe/plugins/registry.go @@ -252,8 +252,8 @@ func (r *Registry) updateAndGetControlsInTopology(pluginID string, topology *rep for name, node := range topology.Nodes { log.Debugf("plugins: checking node controls in node %s of %s", name, topology.Label) newNode := node.WithID(name) - newLatestControls := report.MakeNodeControlDataLatestMap() - node.LatestControls.ForEach(func(controlID string, ts time.Time, data report.NodeControlData) { + newLatestControls := []string{} + for _, controlID := range node.ActiveControls() { log.Debugf("plugins: got node control %s", controlID) newControlID := "" if _, found := topology.Controls[controlID]; !found { @@ -263,9 +263,9 @@ func (r *Registry) updateAndGetControlsInTopology(pluginID string, topology *rep newControlID = fakeControlID(pluginID, controlID) log.Debugf("plugins: will replace node control %s with %s", controlID, newControlID) } - newLatestControls = newLatestControls.Set(newControlID, ts, data) - }) - newNode.LatestControls = newLatestControls + newLatestControls = append(newLatestControls, newControlID) + } + newNode = newNode.WithLatestActiveControls(newLatestControls...) newNodes[newNode.ID] = newNode } topology.Controls = newControls diff --git a/probe/plugins/registry_internal_test.go b/probe/plugins/registry_internal_test.go index b47916818..1259bf6ef 100644 --- a/probe/plugins/registry_internal_test.go +++ b/probe/plugins/registry_internal_test.go @@ -627,14 +627,9 @@ func checkControls(t *testing.T, topology report.Topology, expectedControls, exp if !found { t.Fatalf("expected a node %s in a topology", nodeID) } - actualNodeControls := []string{} - node.LatestControls.ForEach(func(controlID string, _ time.Time, _ report.NodeControlData) { - actualNodeControls = append(actualNodeControls, controlID) - }) - nodeControlsSet := report.MakeStringSet(expectedNodeControls...) - actualNodeControlsSet := report.MakeStringSet(actualNodeControls...) - if !reflect.DeepEqual(nodeControlsSet, actualNodeControlsSet) { - t.Fatalf("node controls in node %s in topology %s are not equal:\n%s", nodeID, topology.Label, test.Diff(nodeControlsSet, actualNodeControlsSet)) + actualNodeControls := node.ActiveControls() + if !reflect.DeepEqual(expectedNodeControls, actualNodeControls) { + t.Fatalf("node controls in node %s in topology %s are not equal:\n%s", nodeID, topology.Label, test.Diff(expectedNodeControls, actualNodeControls)) } }