setup_network() implemented by the test framework connects all nodes, as explained by the comment in
setup_network(). Since you want node 2 to be connected to nodes 1 and 0, you can simply delete the
setup_network() implemented in
example_test.py to use the default
setup_network(). Then inside of
run_test(), you can just do
.generate() with any of the nodes and the block should be synced to all of the other nodes.
To guarantee that all nodes are synced to the same block, you can use
self.sync_blocks() which will ensure that every node has the same tip before it returns.
Your run test would have something like: