Skip to content

Fix undeterministic tests #452

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

juliangruber
Copy link
Member

No description provided.

@bajtos
Copy link
Member

bajtos commented Nov 27, 2024

I think the right solution is to modify the code setting up eligible deals to delete any deals created by previous runs.

Current code:

    before(async () => {
      await client.query(`
        INSERT INTO retrievable_deals (cid, miner_id, client_id, expires_at)
        VALUES
        ('bafyone', 'f0210', 'f0800', '2100-01-01'),
        ('bafyone', 'f0220', 'f0800', '2100-01-01'),
        ('bafytwo', 'f0220', 'f0810', '2100-01-01'),
        ('bafyone', 'f0230', 'f0800', '2100-01-01'),
        ('bafytwo', 'f0230', 'f0800', '2100-01-01'),
        ('bafythree', 'f0230', 'f0810', '2100-01-01'),
        ('bafyfour', 'f0230', 'f0820', '2100-01-01'),
        ('bafyexpired', 'f0230', 'f0800', '2020-01-01')
        ON CONFLICT DO NOTHING
      `)
      await client.query(`
        INSERT INTO allocator_clients (allocator_id, client_id)
        VALUES
        ('f0500', 'f0800'),
        ('f0500', 'f0810'),
        ('f0520', 'f0820')
        ON CONFLICT DO NOTHING
      `)
    })

What to do: before inserting into retrievable_deals, delete any existing rows where miner_id is f0210, f0220 or f0230.

@bajtos
Copy link
Member

bajtos commented Nov 27, 2024

It's also possible my understanding is wrong and the suggestion above won't fix anything.

@bajtos
Copy link
Member

bajtos commented Nov 27, 2024

Since it's difficult to figure out why these tests are failing on the subsequent run, it would be great to start by adding more visibility into what's happening under the hood. E.g. add debug() statements to print full details of the eligible deals for the queried miner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants