Re: Review Request 15175: Added a verifyElementInList utility function

2013-11-08 Thread Girish Shilamkar

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15175/#review28513
---


4.2: b18e730108e6a24e00c372e3c56c655ff51106ba

- Girish Shilamkar


On Nov. 1, 2013, 7:44 a.m., Santhosh Edukulla wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/15175/
 ---
 
 (Updated Nov. 1, 2013, 7:44 a.m.)
 
 
 Review request for cloudstack, Girish Shilamkar and Prasanna Santhanam.
 
 
 Repository: cloudstack-git
 
 
 Description
 ---
 
 The purpose is to verify a given element in list at a given position with few 
 error checks like list type,empty list and position
 Returns appropriate codes based upon the inputs. Can be used under tests 
 instead of multiple asserts
  
 Earlier, there was a list validity function, this is on top of that.

 Need to go to both master and 4.2
 
 
 Diffs
 -
 
   tools/marvin/marvin/codes.py bd01ad3 
   tools/marvin/marvin/integration/lib/utils.py b6e38ec 
 
 Diff: https://reviews.apache.org/r/15175/diff/
 
 
 Testing
 ---
 
 Tested.
 
  from utils import verifyElementInList
  a=[1,2,3]
  verifyElementInList(a,2)
 [0, 'ELEMENT NOT FOUND IN THE INPUT']
  verifyElementInList(a,1)
 [1, None]
  verifyElementInList(a,3)
 [0, 'ELEMENT NOT FOUND IN THE INPUT']
 
 
 Thanks,
 
 Santhosh Edukulla
 




Re: Review Request 15175: Added a verifyElementInList utility function

2013-11-04 Thread Prasanna Santhanam

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15175/#review28085
---


Easier to do if a in [1,2,3]: , no?

- Prasanna Santhanam


On Nov. 1, 2013, 7:44 a.m., Santhosh Edukulla wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/15175/
 ---
 
 (Updated Nov. 1, 2013, 7:44 a.m.)
 
 
 Review request for cloudstack, Girish Shilamkar and Prasanna Santhanam.
 
 
 Repository: cloudstack-git
 
 
 Description
 ---
 
 The purpose is to verify a given element in list at a given position with few 
 error checks like list type,empty list and position
 Returns appropriate codes based upon the inputs. Can be used under tests 
 instead of multiple asserts
  
 Earlier, there was a list validity function, this is on top of that.

 Need to go to both master and 4.2
 
 
 Diffs
 -
 
   tools/marvin/marvin/codes.py bd01ad3 
   tools/marvin/marvin/integration/lib/utils.py b6e38ec 
 
 Diff: https://reviews.apache.org/r/15175/diff/
 
 
 Testing
 ---
 
 Tested.
 
  from utils import verifyElementInList
  a=[1,2,3]
  verifyElementInList(a,2)
 [0, 'ELEMENT NOT FOUND IN THE INPUT']
  verifyElementInList(a,1)
 [1, None]
  verifyElementInList(a,3)
 [0, 'ELEMENT NOT FOUND IN THE INPUT']
 
 
 Thanks,
 
 Santhosh Edukulla
 




Re: Review Request 15175: Added a verifyElementInList utility function

2013-11-04 Thread Santhosh Edukulla


 On Nov. 4, 2013, 8:21 a.m., Prasanna Santhanam wrote:
  Easier to do if a in [1,2,3]: , no?

1. Purpose is to check whether the input is list and whether it is empty as 
well.

2. If it is not a list, then a in None will lead to exception.

3. Purpose is also to provide a generic api to check the element presence at a 
given position as well. a in [1,2,3] will check, if  a is in the list but which 
position we are expecting this element to be? so position is also required, 
generally we are verifying the first element so we keyworded the pos=0 to make 
it easier.

4. Provide custom error codes and messages for log and further processing.

5. This will benefit the case to remove multiple asserts in to one single line 
of code with new utility and make it cleaner to maintain at one place.

self.assertEqual(
isinstance(list_network_offerings_response, list),
True,
listNetworkOfferings returned invalid object in response.
)

self.assertNotEqual(
len(list_network_offerings_response),
0,
listNetworkOfferings returned empty list.
)

self.assertEqual(
list_network_offerings_response[0].state,
Enabled,
The network offering state should get updated to Enabled.
)


- Santhosh


---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15175/#review28085
---


On Nov. 1, 2013, 7:44 a.m., Santhosh Edukulla wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/15175/
 ---
 
 (Updated Nov. 1, 2013, 7:44 a.m.)
 
 
 Review request for cloudstack, Girish Shilamkar and Prasanna Santhanam.
 
 
 Repository: cloudstack-git
 
 
 Description
 ---
 
 The purpose is to verify a given element in list at a given position with few 
 error checks like list type,empty list and position
 Returns appropriate codes based upon the inputs. Can be used under tests 
 instead of multiple asserts
  
 Earlier, there was a list validity function, this is on top of that.

 Need to go to both master and 4.2
 
 
 Diffs
 -
 
   tools/marvin/marvin/codes.py bd01ad3 
   tools/marvin/marvin/integration/lib/utils.py b6e38ec 
 
 Diff: https://reviews.apache.org/r/15175/diff/
 
 
 Testing
 ---
 
 Tested.
 
  from utils import verifyElementInList
  a=[1,2,3]
  verifyElementInList(a,2)
 [0, 'ELEMENT NOT FOUND IN THE INPUT']
  verifyElementInList(a,1)
 [1, None]
  verifyElementInList(a,3)
 [0, 'ELEMENT NOT FOUND IN THE INPUT']
 
 
 Thanks,
 
 Santhosh Edukulla
 




Re: Review Request 15175: Added a verifyElementInList utility function

2013-11-04 Thread Prasanna Santhanam

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15175/#review28088
---


Just thinking aloud, could we not provide customized-assert for this rather 
than utility functions? I'm thinking something like:

self.assertElementInList(a, [1,2,3], msg=a is not in list)


- Prasanna Santhanam


On Nov. 1, 2013, 7:44 a.m., Santhosh Edukulla wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/15175/
 ---
 
 (Updated Nov. 1, 2013, 7:44 a.m.)
 
 
 Review request for cloudstack, Girish Shilamkar and Prasanna Santhanam.
 
 
 Repository: cloudstack-git
 
 
 Description
 ---
 
 The purpose is to verify a given element in list at a given position with few 
 error checks like list type,empty list and position
 Returns appropriate codes based upon the inputs. Can be used under tests 
 instead of multiple asserts
  
 Earlier, there was a list validity function, this is on top of that.

 Need to go to both master and 4.2
 
 
 Diffs
 -
 
   tools/marvin/marvin/codes.py bd01ad3 
   tools/marvin/marvin/integration/lib/utils.py b6e38ec 
 
 Diff: https://reviews.apache.org/r/15175/diff/
 
 
 Testing
 ---
 
 Tested.
 
  from utils import verifyElementInList
  a=[1,2,3]
  verifyElementInList(a,2)
 [0, 'ELEMENT NOT FOUND IN THE INPUT']
  verifyElementInList(a,1)
 [1, None]
  verifyElementInList(a,3)
 [0, 'ELEMENT NOT FOUND IN THE INPUT']
 
 
 Thanks,
 
 Santhosh Edukulla
 




Re: Review Request 15175: Added a verifyElementInList utility function

2013-11-04 Thread Prasanna Santhanam

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15175/#review28089
---


Also your patch failed to apply for me on latest master:

~/workspace/cloudstack/incubator-cloudstack(branch:master) » git am 
patch/element.patch
Applying: Added a verifyElementInList utility function
/Users/tsp/workspace/cloudstack/incubator-cloudstack/.git/rebase-apply/patch:27:
 trailing whitespace.
   @Description: 
/Users/tsp/workspace/cloudstack/incubator-cloudstack/.git/rebase-apply/patch:33:
 trailing whitespace.
 at a given pos  
/Users/tsp/workspace/cloudstack/incubator-cloudstack/.git/rebase-apply/patch:34:
 trailing whitespace.
   @Input: 
/Users/tsp/workspace/cloudstack/incubator-cloudstack/.git/rebase-apply/patch:36:
 trailing whitespace.
 II  : Element to verify whether it exists in the list 
error: patch failed: tools/marvin/marvin/codes.py:39
error: tools/marvin/marvin/codes.py: patch does not apply
error: patch failed: tools/marvin/marvin/integration/lib/utils.py:353
error: tools/marvin/marvin/integration/lib/utils.py: patch does not apply
Patch failed at 0001 Added a verifyElementInList utility function
When you have resolved this problem run git am --resolved.
If you would prefer to skip this patch, instead run git am --skip.
To restore the original branch and stop patching run git am --abort.


- Prasanna Santhanam


On Nov. 1, 2013, 7:44 a.m., Santhosh Edukulla wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/15175/
 ---
 
 (Updated Nov. 1, 2013, 7:44 a.m.)
 
 
 Review request for cloudstack, Girish Shilamkar and Prasanna Santhanam.
 
 
 Repository: cloudstack-git
 
 
 Description
 ---
 
 The purpose is to verify a given element in list at a given position with few 
 error checks like list type,empty list and position
 Returns appropriate codes based upon the inputs. Can be used under tests 
 instead of multiple asserts
  
 Earlier, there was a list validity function, this is on top of that.

 Need to go to both master and 4.2
 
 
 Diffs
 -
 
   tools/marvin/marvin/codes.py bd01ad3 
   tools/marvin/marvin/integration/lib/utils.py b6e38ec 
 
 Diff: https://reviews.apache.org/r/15175/diff/
 
 
 Testing
 ---
 
 Tested.
 
  from utils import verifyElementInList
  a=[1,2,3]
  verifyElementInList(a,2)
 [0, 'ELEMENT NOT FOUND IN THE INPUT']
  verifyElementInList(a,1)
 [1, None]
  verifyElementInList(a,3)
 [0, 'ELEMENT NOT FOUND IN THE INPUT']
 
 
 Thanks,
 
 Santhosh Edukulla
 




Re: Review Request 15175: Added a verifyElementInList utility function

2013-11-04 Thread Santhosh Edukulla


 On Nov. 4, 2013, 8:48 a.m., Prasanna Santhanam wrote:
  Also your patch failed to apply for me on latest master:
  
  ~/workspace/cloudstack/incubator-cloudstack(branch:master) » git am 
  patch/element.patch
  Applying: Added a verifyElementInList utility function
  /Users/tsp/workspace/cloudstack/incubator-cloudstack/.git/rebase-apply/patch:27:
   trailing whitespace.
 @Description: 
  /Users/tsp/workspace/cloudstack/incubator-cloudstack/.git/rebase-apply/patch:33:
   trailing whitespace.
   at a given pos  
  /Users/tsp/workspace/cloudstack/incubator-cloudstack/.git/rebase-apply/patch:34:
   trailing whitespace.
 @Input: 
  /Users/tsp/workspace/cloudstack/incubator-cloudstack/.git/rebase-apply/patch:36:
   trailing whitespace.
   II  : Element to verify whether it exists in the list 
  error: patch failed: tools/marvin/marvin/codes.py:39
  error: tools/marvin/marvin/codes.py: patch does not apply
  error: patch failed: tools/marvin/marvin/integration/lib/utils.py:353
  error: tools/marvin/marvin/integration/lib/utils.py: patch does not apply
  Patch failed at 0001 Added a verifyElementInList utility function
  When you have resolved this problem run git am --resolved.
  If you would prefer to skip this patch, instead run git am --skip.
  To restore the original branch and stop patching run git am --abort.
 

This patch already is applied to master and i could see it there, may be the 
status was not changed or not marked with ship it.


- Santhosh


---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15175/#review28089
---


On Nov. 1, 2013, 7:44 a.m., Santhosh Edukulla wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/15175/
 ---
 
 (Updated Nov. 1, 2013, 7:44 a.m.)
 
 
 Review request for cloudstack, Girish Shilamkar and Prasanna Santhanam.
 
 
 Repository: cloudstack-git
 
 
 Description
 ---
 
 The purpose is to verify a given element in list at a given position with few 
 error checks like list type,empty list and position
 Returns appropriate codes based upon the inputs. Can be used under tests 
 instead of multiple asserts
  
 Earlier, there was a list validity function, this is on top of that.

 Need to go to both master and 4.2
 
 
 Diffs
 -
 
   tools/marvin/marvin/codes.py bd01ad3 
   tools/marvin/marvin/integration/lib/utils.py b6e38ec 
 
 Diff: https://reviews.apache.org/r/15175/diff/
 
 
 Testing
 ---
 
 Tested.
 
  from utils import verifyElementInList
  a=[1,2,3]
  verifyElementInList(a,2)
 [0, 'ELEMENT NOT FOUND IN THE INPUT']
  verifyElementInList(a,1)
 [1, None]
  verifyElementInList(a,3)
 [0, 'ELEMENT NOT FOUND IN THE INPUT']
 
 
 Thanks,
 
 Santhosh Edukulla
 




Re: Review Request 15175: Added a verifyElementInList utility function

2013-11-04 Thread Santhosh Edukulla

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15175/#review28095
---

Ship it!


Ship It!

- Santhosh Edukulla


On Nov. 1, 2013, 7:44 a.m., Santhosh Edukulla wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 https://reviews.apache.org/r/15175/
 ---
 
 (Updated Nov. 1, 2013, 7:44 a.m.)
 
 
 Review request for cloudstack, Girish Shilamkar and Prasanna Santhanam.
 
 
 Repository: cloudstack-git
 
 
 Description
 ---
 
 The purpose is to verify a given element in list at a given position with few 
 error checks like list type,empty list and position
 Returns appropriate codes based upon the inputs. Can be used under tests 
 instead of multiple asserts
  
 Earlier, there was a list validity function, this is on top of that.

 Need to go to both master and 4.2
 
 
 Diffs
 -
 
   tools/marvin/marvin/codes.py bd01ad3 
   tools/marvin/marvin/integration/lib/utils.py b6e38ec 
 
 Diff: https://reviews.apache.org/r/15175/diff/
 
 
 Testing
 ---
 
 Tested.
 
  from utils import verifyElementInList
  a=[1,2,3]
  verifyElementInList(a,2)
 [0, 'ELEMENT NOT FOUND IN THE INPUT']
  verifyElementInList(a,1)
 [1, None]
  verifyElementInList(a,3)
 [0, 'ELEMENT NOT FOUND IN THE INPUT']
 
 
 Thanks,
 
 Santhosh Edukulla
 




Review Request 15175: Added a verifyElementInList utility function

2013-11-01 Thread Santhosh Edukulla

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15175/
---

Review request for cloudstack, Girish Shilamkar and Prasanna Santhanam.


Repository: cloudstack-git


Description
---

The purpose is to verify a given element in list at a given position with few 
error checks like list type,empty list and position
Returns appropriate codes based upon the inputs. Can be used under tests 
instead of multiple asserts
 
Earlier, there was a list validity function, this is on top of that.
   
Need to go to both master and 4.2


Diffs
-

  tools/marvin/marvin/codes.py bd01ad3 
  tools/marvin/marvin/integration/lib/utils.py b6e38ec 

Diff: https://reviews.apache.org/r/15175/diff/


Testing
---

Tested.

 from utils import verifyElementInList
 a=[1,2,3]
 verifyElementInList(a,2)
[0, 'ELEMENT NOT FOUND IN THE INPUT']
 verifyElementInList(a,1)
[1, None]
 verifyElementInList(a,3)
[0, 'ELEMENT NOT FOUND IN THE INPUT']


Thanks,

Santhosh Edukulla