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

Improved tests for vmpooler #152

Merged
merged 26 commits into from
Jun 7, 2016
Merged

Improved tests for vmpooler #152

merged 26 commits into from
Jun 7, 2016

Conversation

rick
Copy link
Contributor

@rick rick commented May 20, 2016

The tests for the vmpooler mock and stub their way to glory. The actual code is really heavy on the "use crazy redis strings everywhere" (which is mirrored in the tests). Taking a stab at making these tests be non-mockist, using actual state on the back-end, and defining the semantics of the operations we're performing.

My hope is that we get a less fragile + more readable suite in the process, and also can begin to refactor the code base, to extract and put semantic names around bits of redis-munging code scattered around (also, move the redis code out of the API into the lower lib/ service layer(s)).

Open issues / TODO:

  • continue de-mockistifying specs
  • this probably needs to clean up test state on teardown better (or at all)
  • this probably wants to use a separate redis database, so as not to clobber local redis databases that might be around. Redis uses numbered databases (what could go wrong?) still, right? Wonder if we have good examples around this we can get inspired by.

/cc @stahnma @heathseals @joshcooper

rick added 3 commits May 20, 2016 15:26
Open questions:

 - Do we need to do better cleanup here?
 - Should we be using a separate database to prevent clobbering other local db's?
rick added 23 commits May 27, 2016 10:39
Miscellaneous whitespace cleanup.
Given the way we're flushing redis (which seems super performant), we don't
need to clear pools any more at the beginning of tests.
The mockist version of the test allows redis' scard to return nil, which
it does not actually do in real life. Verified the behavior in the code
via a debugger. Fixed the test.
@rick
Copy link
Contributor Author

rick commented Jun 2, 2016

Could use some 👀 on this now.

I've upgraded the API tests as well as the dashboard tests to use live redis and no longer rely on mocking and stubbing. This fixed a few tests in the process, and ends up testing the actual underlying state of the world in a few cases, where before we were mostly just checking that an HTTP status code with valid JSON were being returned.

There are a couple of files I didn't touch (in part because they seemed weird and confusing, and in part to ship something of benefit, even if not everything is covered):

The work from #153 (which was merged to the ci.next branch) would want to merge this up and have the new tests it introduced updated once this lands. Shouldn't be difficult.

A couple of other cc's of potentially interested parties: @shermdog @heathseals

@rick rick changed the title [WIP] Improved tests for vmpooler Improved tests for vmpooler Jun 2, 2016
@rick
Copy link
Contributor Author

rick commented Jun 7, 2016

I'm going to merge my own PR unless I get a 👎.

@shermdog shermdog merged commit 26ca390 into master Jun 7, 2016
joshcooper added a commit that referenced this pull request Jul 8, 2016
…i.next

* origin/master:
  Added IP lookup functionality for /vm/hostname (#154)
  Add info about vmfloaty
  Improved tests for vmpooler (#152)
@rooneyshuman rooneyshuman deleted the improved-tests branch June 5, 2020 18:50
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

Successfully merging this pull request may close these issues.

2 participants