bittensor icon indicating copy to clipboard operation
bittensor copied to clipboard

Tests for metagraph, highlighting bug

Open mvds00 opened this issue 1 year ago • 5 comments

Bug

The e2e test that tests metagraph has some flaws. Some assertions don't work as intended and a bug in metagraph is not caught. While I was at it I fixed some low hanging fruit, that is, some fragile constructions that may turn into bugs later on.

Description of the Change

  • don't split lines, assert particular strings in complete output so specific line number doesn't matter
  • fix assert 'a' and 'b' in s as it doesn't test whether both 'a' and 'b' are in s
  • replace magic constant 1 with netuid
  • create an additional subnet to make the test coverage broader
  • test .save() and .load() on metagraph

note that the last test fails, but that is due to a bug in bittensor that has to be solved. This PR demonstrates there is a bug, and provides a test to see whether a (to be written) fix solves the bug.

Alternate Designs

Not relevant.

Possible Drawbacks

N/A

Verification Process

By doing metagraph_pre_dave = subtensor.metagraph(netuid=netuid) instead of metagraph_pre_dave.load() it was verified that the assertions comparing distinct metagraph objects should work, if the metagraphs are in sync.

Release Notes

N/A

mvds00 avatar Aug 04 '24 19:08 mvds00