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: revisit how stats are made available #147

Open
julen opened this issue Dec 20, 2016 · 0 comments
Open

Tests: revisit how stats are made available #147

julen opened this issue Dec 20, 2016 · 0 comments

Comments

@julen
Copy link
Contributor

julen commented Dec 20, 2016

In #138 we made sure stats are made available to the test functions that require it by leveraging the refresh_stats fixture. The implementation might seem more like a workaround though.

We need to come up with a more robust solution that ensures predictability while not sacrificing speed.

Bringing here some ideas outlined in the original PR thread:

Improve TreeItem's testability

  • Make TreeItem operations no-op by default in the test environment.
    This removes the chance for accidental poisoning. We can also think of alternative ways to make this class easier to test.
  • Individual tests that require R/W access to stats can explicitly request so (via a custom marker, for instance), hence circumventing the default behavior.

Imitate rollback via code

  • Redis has DUMP and RESTORE commands that might come handy. If we know that a specific test is going to alter certain keys, we can wrap it with the decorator that will backup keys before they are modified with the application code, and then restore the modified keys once the test is finished.
  • This will allow us to actually test how the stats are affected during tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant