Uh oh!
There was an error while loading. Please reload this page.
Wrong provider name in answers.conf, exits AtomicApp with readable error - #563
Conversation
| import logging | ||
| from atomicapp import set_logging |
dustymabe
commented
Feb 17, 2016
dustymabe
commented
Feb 17, 2016
@rtnpro should we also write a test for this? |
| @@ -1,11 +1,18 @@ | |||
| # -*- coding: utf-8 -*- | |||
| import sys | |||
rtnpro
commented
Feb 17, 2016
@surajssd could you have a look at https://travis-ci.org/projectatomic/atomicapp/builds/109825603? I think with the suggested refactor, it should be OK. |
0cd8e76 to
eae57d1Comparertnpro
commented
Feb 18, 2016
@surajssd Mind adding unittests for |
| raise NuleculeException("Invalid Provider - '{}', provided in " | ||
| "answers.conf (choose from 'docker', " | ||
| "'kubernetes', 'openshift', 'marathon')" | ||
| .format(provider_key)) |
There was a problem hiding this comment.
If we choose to tell them what options they can use then we should be using the PROVIDERS constant from constants.py and not a hardcoded list.
0813d76 to
87ed1adCompare| return provider | ||
| # importing this on top of file leads to circular import | ||
| from atomicapp.nulecule.exceptions import NuleculeException |
There was a problem hiding this comment.
local imports are kind of hacks, and I prefer to avoid them. Let's not reference Nulecule* things in plugin.py at all, because, plugin.py is a dependency for Nulecule* and other things. Does it make sense?
There was a problem hiding this comment.
Yes makes sense, but then what exception do I raise here?
There was a problem hiding this comment.
So, as I had said earlier, let's raise an exception in nulecule/main.py when provider is None.
There was a problem hiding this comment.
No need to raise any exception in plugin.py. It returns None because it's not able to find a provider. Simple, isn't it?
87ed1ad to
aa9414fComparertnpro
commented
Feb 22, 2016
@surajssd One last thing, could you add a unittest for |
f8cbf5d to
ea12f35Comparertnpro
commented
Feb 23, 2016
LGTM 👍 @dustymabe shall we merge it in to |
dustymabe
commented
Feb 23, 2016
@rtnpro I trust you. :) - merge away. |
dustymabe
commented
Feb 29, 2016
I think we need to do a better job of commenting the tests. Without knowing mock I should be able to read through the code and get a high level understanding of what it is testing. |
surajssd
commented
Mar 1, 2016
Yes sure, its harder for somebody not knowing mock to understand what is actually going on! |
dustymabe
commented
Mar 1, 2016
@surajssd - rebase on upstream master so we can merge.. bonus points if you comment the tests :) |
When provider name in answers.conf is wrong then AtomicApp fails with stack-trace and no error output which is user understandable. This happened because there was no check for the condition if given provider_key does not match with any of the providers that are supported for now. Fixes Issue projectatomic#562.
ea12f35 to
063a59bComparesurajssd
commented
Mar 3, 2016
@dustymabe I have added comments, was little confused about what all to include into them, share your views. |
dustymabe
commented
Mar 4, 2016
@cdrage can you merge this if tests pass and you are satisfied with everything? |
cdrage
commented
Mar 4, 2016
Tests pass and code looks good. Thank you for the extensives tests by the way! 💃 |
When
providername inanswers.confis wrong then AtomicApp fails with stack-trace and no error output which is user understandable. This happened because there was no check for the condition ifgiven
provider_keydoes not match with any of the providers that are supported for now.Fixes Issue #562