-
Notifications
You must be signed in to change notification settings - Fork 54
Conversation
Finished adjustments for api/main.py
@henn, I think you linked to the wrong commit; that's just a typo fix. Why (and how) would you need to modify the database migration check for that? This patch doesn't appear to touch the database at all. I am highly confused. |
@@ -388,45 +394,66 @@ def initial_db(): | |||
username='bob', | |||
password='password', | |||
type=MockSwitch.api_name) | |||
db.session.add(switch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change initial_db; it needs to create the exact same set of objects in |
@zenhack Thx, I got a clear point now. Prepare to fix the test and fixture soon. |
Added additional_db fixture to resolve migration issue.
Finally my first PR is done. Besides modified the I apologize for some messy code due to using YAPF to auto format the code. |
@knikolla do you feel like having some time to do a code review? A large part of the code is because of the code formatting so it should not take too much time. |
Can you make the code formatting step be a separate pull request? |
@gsilvis you are right and I just revert the irritating formatting stuff. Code formatting should be in the pep8 PR. |
Thanks, that makes it a lot easier to read |
Most of the changes here are adding identical lines to several different tests. Is it possible to use a fixture or something to make it available to any test that needs it? |
@SahilTikale @henn do you guys got a minute to take a look and do a code review? |
Waitting for code review. |
To solve the identical lines problem, I think it is possible to do a shorthand and put sth like this in it.
However, this kind of shorthand will reduce the readability of |
@shwsun, almost all of those lines actually have the same values for The way the tests in that file are written is something we've recognized as having been a mistake; Ideally we would move most of the rest of the object creation out of the tests and into fixtures as well (though that's out of scope for this pr). We want to keep the content of the test functions themselves down to the property they're actualy testing; setup code goes elsewhere. |
That philosophy is actually sth I agree with. |
I wrote a small pytest fixture to cover these identical test code. Need code review. |
Needs code review. @zenhack @SahilTikale @gsilvis @henn anyone has some time? |
@@ -798,6 +798,8 @@ Authorization requirements: | |||
|
|||
Possible errors: | |||
|
|||
* 404, if no port is connected to the given nic. | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be no blank line here.
I made one last very minor comment; once that's addressed I'm happy. |
Looks good, +1. |
+1, merging. |
This PR solves #474 . Basically it does a check port action before every
node_connect_network
. This behavior is useful cause when using HIL in real life it is hard to debug whether a port is already attached to the node's nic.It also did
tests/unit/api/
adjustments since check port is not taken into consideration before.