p2p/dnsdisc: using clear builtin func (#29418)
Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
parent
eea0acc549
commit
2e0c5e05ba
@ -215,7 +215,7 @@ func TestIteratorNodeUpdates(t *testing.T) {
|
|||||||
// Ensure RandomNode returns the new nodes after the tree is updated.
|
// Ensure RandomNode returns the new nodes after the tree is updated.
|
||||||
updateSomeNodes(keys, nodes)
|
updateSomeNodes(keys, nodes)
|
||||||
tree2, _ := makeTestTree("n", nodes, nil)
|
tree2, _ := makeTestTree("n", nodes, nil)
|
||||||
resolver.clear()
|
clear(resolver)
|
||||||
resolver.add(tree2.ToTXT("n"))
|
resolver.add(tree2.ToTXT("n"))
|
||||||
t.Log("tree updated")
|
t.Log("tree updated")
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ func TestIteratorRootRecheckOnFail(t *testing.T) {
|
|||||||
// Ensure RandomNode returns the new nodes after the tree is updated.
|
// Ensure RandomNode returns the new nodes after the tree is updated.
|
||||||
updateSomeNodes(keys, nodes)
|
updateSomeNodes(keys, nodes)
|
||||||
tree2, _ := makeTestTree("n", nodes, nil)
|
tree2, _ := makeTestTree("n", nodes, nil)
|
||||||
resolver.clear()
|
clear(resolver)
|
||||||
resolver.add(tree2.ToTXT("n"))
|
resolver.add(tree2.ToTXT("n"))
|
||||||
t.Log("tree updated")
|
t.Log("tree updated")
|
||||||
|
|
||||||
@ -447,12 +447,6 @@ func newMapResolver(maps ...map[string]string) mapResolver {
|
|||||||
return mr
|
return mr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mr mapResolver) clear() {
|
|
||||||
for k := range mr {
|
|
||||||
delete(mr, k)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mr mapResolver) add(m map[string]string) {
|
func (mr mapResolver) add(m map[string]string) {
|
||||||
maps.Copy(mr, m)
|
maps.Copy(mr, m)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user