-
Notifications
You must be signed in to change notification settings - Fork 665
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
[config] Add unit tests for 'config interface breakout' command #1223
Conversation
5860 is not going to be approved. please add natsorted in your test. |
@lguohan |
@lguohan: This PR is up for review now, i.e not dependent on other PR. Thanks. |
retest default please |
retest this please |
Retest this please |
7a8e32d
to
a0e2d80
Compare
…' command. Signed-off-by: Praveen Chaudhary<[email protected]>
Signed-off-by: Praveen Chaudhary<[email protected]>
Doing some force pushes to fix a issue seen with PY3, do not mind. |
5bcf2f5
to
ddcc2de
Compare
….py for PY3 support. changes: -- Changing Class name -- minor fix in main.py for PY3 support -- remove sort_data from config_mgmt.py Signed-off-by: Praveen Chaudhary<[email protected]>
ddcc2de
to
6047412
Compare
@jleveque and @lguohan : I had to try couple of PY3 fix, so did force push. Now I see that new tests are always passing, but there are console_test.py failures, which are not related to my changes. I will rerun my tests once console_test.py is solved. Thx.
|
retest this please |
3 similar comments
retest this please |
retest this please |
retest this please |
retest this please |
588d130
to
9a7755a
Compare
9a7755a
to
50e6439
Compare
I realized that, I was adding below line on teardown() of my test class, which makes console_test fail. Resolve it. os.environ["PATH"] = os.pathsep.join(os.environ["PATH"].split(os.pathsep)[:-1]) |
Aha. Yes, I found and fixed other tests recently which were doing the same thing in the teardown function but not appending to the PATH in the setup function, thus breaking the PATH. 👍 |
@jleveque |
…c-net#1223) Consideration for sonic utilities breakout config tests: -- create a breakout config file, -- mock load_configMgmt() to return specially constructed configMgmtDPB instance. -- Device info get_ path*__file function should return default file so it should be mocked. -- config db must have breakout config table. -- mock get child ports to return interfaces, if needed. -- mock shut down interfaces, if needed. *Test Plan:* *>>> Test _get_ breakout options()* -- create a file breakout config. This can be a PY test fixture. -- mock device information part to return breakout file. -- pass argument incomplete as below and observe the results: a.) 1x1 b.) 4x c.) 2x d.) Wrong interface. *>> Test Verbose Args:* Pass verbose as args, and observe that loadConfigMgmt is called with verbose. *>> Test breakout_extra_table_warning Args:* Test breakout_extra_table_warning for breakout port. Add unknown_table to config with port which will be broken out Observe: Warning and ask User confirmation for the tables WithOut Yang models. *>>> Test Negative case: Test negative case of breakout port. Such as: Wrong Interface, wrong option and Wrong breakout Mode for DPB Command. *>>> Test below Config Breakout commands:* [Mock loadConfigMgmt and device info part for all below tests] [Load a fixed config in Data Tree, i.e. may not be same as configDB from mockTables] [Replace the configDB.json with test config if needed. Or correct configDB then use it. Also replace it at the end with original Config] [Note: we are testing only main.py part not config_mgmt.py] [Observe point for all below will be: a.) Click.echo part and b.) Update to BRK_CFG table in in-memory DB] # Ethernet8: start from 4x25G-->2x50G with -f -l sudo config interface breakout Ethernet8 2x50G -f -l # Ethernet8: move from 2x50G-->1x100G without force, list deps sudo config interface breakout Ethernet8 1x100G[40G] -f -l # Ethernet8: move from 2x50G-->1x100G with force, where deps exists sudo config interface breakout Ethernet8 1x100G[40G] -f # Ethernet8: move from 1x100G-->4x25G without force, no deps sudo config interface breakout Ethernet8 4x25G # Ethernet8: move from 4x25G-->1x100G with force, no deps sudo config interface breakout Ethernet8 1x100G -f # Ethernet8: move from 1x100G-->1x50G(2)+2x25G(2) with -f -l, sudo config interface breakout Ethernet8 1x50G(2)+2x25G(2) -f -l # Ethernet4: breakout from 4x25G to 2x50G with -f -l sudo config interface breakout Ethernet4 2x50G -f -l Signed-off-by: Praveen Chaudhary<[email protected]>
Signed-off-by: Praveen Chaudhary[email protected]
- What I did
Sonic Utils test for 'config interface breakout' command.
- How I did it
As per test plan above.
- How to verify it
- Previous command output (if the output of a command-line utility has changed)
- New command output (if the output of a command-line utility has changed)