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

Add dummy and virtual objects for testing #125

Merged
merged 11 commits into from
Jul 20, 2016

Conversation

kitchoi
Copy link
Contributor

@kitchoi kitchoi commented Jul 19, 2016

Provides for #98

Work in progress.
(should have named the branch differently...never mind)

@codecov-io
Copy link

codecov-io commented Jul 19, 2016

Current coverage is 84.97%

Merging #125 into master will decrease coverage by 0.07%

@@             master       #125   diff @@
==========================================
  Files            36         36          
  Lines          1344       1344          
  Methods           0          0          
  Messages          0          0          
  Branches        123        123          
==========================================
- Hits           1143       1142     -1   
- Misses          165        166     +1   
  Partials         36         36          

Powered by Codecov. Last updated by 14d01c6...b54ebe9

@kitchoi kitchoi changed the title Add dummy and virtual objects for testing [WIP] Add dummy and virtual objects for testing Jul 19, 2016
@kitchoi
Copy link
Contributor Author

kitchoi commented Jul 19, 2016

@sbo I have added a number of dummy/virtual objects for Application, Accounting, Hub, ReverseProxy, ContainerManager and docker.Client

I had to modify some tests to validate that these objects work. I also noticed that TestContainerManager would have clash with #126, in which case I am happy to resolve the conflicts on this branch.

Some existing tests can switch to using these dummy objects, but I have not done in order to make it easier to review.

@stefanoborini
Copy link
Contributor

Ok, the other branch touches more files, so to reduce risk let's merge that one first and this one second. We'll do the switch progressively or in a separate PR.

In the meantime, I review this one and you can review the other one.

@@ -131,7 +131,7 @@ def test_retrieve(self):
self.assertEqual(res.code, httpstatus.NOT_FOUND)

self._app.container_manager.docker_client.containers = \
mock_coro_factory(return_value=[utils.containers_dict()])
mock_coro_factory(return_value=[containers_dict()])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can mock the internal sync client instead...

Just a comment. I would not do it now, but useful to consider. I changed the AsyncDockerClient.client to _sync_client, so if you change it now it would need change again. Let's wait.

@stefanoborini
Copy link
Contributor

General comment. A lot of the current boilerplate output we have in utils is now probably ready to disappear, which is good news



def create_reverse_proxy(params=None,
register_result='',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be convenient at this point to change mock_coro_factory to do exceptions as well as a return value, like mock does. It would simplify our general testing of exceptions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, don't work on that. It's good to keep it into account as a "small task". We can open individual issues for these.

@stefanoborini
Copy link
Contributor

ok. now there's a merge conflict as predicted.

Conflicts:
	tests/docker/test_container_manager.py
@kitchoi
Copy link
Contributor Author

kitchoi commented Jul 20, 2016

@sbo And it is resolved!

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.

3 participants