Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for metagraph, highlighting bug #2203

Open
wants to merge 9 commits into
base: staging
Choose a base branch
from

Conversation

mvds00
Copy link

@mvds00 mvds00 commented Aug 4, 2024

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

@gus-opentensor gus-opentensor added the In Review Cortex Team Members Reviewing label Aug 5, 2024
@gus-opentensor
Copy link
Collaborator

@ibraheem-opentensor could you review when you have time please

@ibraheem-opentensor
Copy link
Contributor

Hey @mvds00
Thank you for your contribution. The test looks good.
Just waiting if you would like to push your fix regarding the .neurons in save/load - otherwise we can also take the task up!

@mvds00
Copy link
Author

mvds00 commented Aug 9, 2024

I will submit a PR.

@heeres heeres force-pushed the feature/mvds00/additional-tests-for-metagraph-highlighting-bug branch from 907f467 to abbe79a Compare August 14, 2024 20:57
@mvds00
Copy link
Author

mvds00 commented Aug 14, 2024

I rebased the PR on staging, the changes are still relevant. It tests save/load - I saw another PR was posted already fixing that.

thewhaleking
thewhaleking previously approved these changes Sep 3, 2024
μ added 4 commits September 3, 2024 13:42
The following does not do what the author probably thought:

   assert 'a' and 'b' in s

as it evaluates as:

   assert 'a' and ('b' in s)

and hence:

   assert 'b' in s

This is fixed by splitting the assertions in two or by changing the
condition to ('a' in s and 'b' in s).
Using variable netuid instead of magic constant 1 (which happens to be
the netuid of the added subnet) provides context to the usage of the
value 1 and makes the test more future proof.
Saving and loading should transfer the complete state of the metagraph.
A minor tweak to the test that increases coverage of the test.
@heeres heeres force-pushed the feature/mvds00/additional-tests-for-metagraph-highlighting-bug branch from abbe79a to b63fae3 Compare September 3, 2024 13:45
@mvds00
Copy link
Author

mvds00 commented Sep 3, 2024

I just rebased it on staging, some tests fail but that is on purpose IIRC.

@mvds00 mvds00 dismissed thewhaleking’s stale review November 12, 2024 22:50

The merge-base changed after approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
In Review Cortex Team Members Reviewing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants