Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Unit tests for tenant AdminCLI #850

Merged
merged 4 commits into from
Jan 11, 2017
Merged

Unit tests for tenant AdminCLI #850

merged 4 commits into from
Jan 11, 2017

Conversation

lipingxue
Copy link
Contributor

This change add unit tests for tenant AdminCLI.

Copy link
Contributor

@shuklanirdesh82 shuklanirdesh82 left a comment

Choose a reason for hiding this comment

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

some of the files are having only new line format change, please remove if it is an accidental change.

self.datastore_name = datastore[0]
self.datastore_path = datastore[2]

if len(datastores) >= 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

this fails when there is only one datastore available in the inventory. Can you please provide a fix or provide an explanation if I have misunderstood?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will not fail the test. Some test case need to run with at least two datastores. Those test will be skipped if the condition is not met.

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry for the confusion...

let's say we have only one datastore if len(datastores) >= 1: satisfies and failed at line:443.

Those test will be skipped if the condition is not met.

Can you please point me to the line which skips the TestTenant when only one datastore is found in the inventory?

Thanks!

""" Test tenant functionality """
# tenant1 info
tenant1_name = "test_tenant1"
vm1_name = 'test_vm1'
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: it is better to randomize the vm name to avoid subsequent failures if cleanup doesn't happen correctly. We have done such exercise recently so it would be great to keep it consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shuklanirdesh82 Could you point me what is the change you made to randomize the vm name? I want to take a look. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment addressed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @lipingxue !

@@ -435,6 +444,7 @@ def test_remove_tenants(self):
description='Some tenant',
vms=vms,
privileges=privileges)

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems this file is having only empty newline, please remove this file from the review if it is an accidental change.

Copy link
Contributor

@msterin msterin left a comment

Choose a reason for hiding this comment

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

overall looks good. Please squash the commits, and more important, outline somewhere what is covered by the test. All tenant-related CLI with all possible options ? Error cases handled?

Even if it's not compete I think we should merge the tests, but it is hard to understand what is covered and what is not.

@@ -1097,6 +1105,7 @@ def test_vmdkops_on_different_tenants(self):

@unittest.skipIf(len(vmdk_utils.get_datastores()) < 2,
"second datastore is not found - skipping this test")
@unittest.skip("Liping remove")
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks like something you want to remove :-)

Copy link
Contributor

@shuklanirdesh82 shuklanirdesh82 left a comment

Choose a reason for hiding this comment

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

Few minor changes are required.

  1. some of the files are having only new line change ...
    Can you please remove those file from this PR and keep only unit test related files?

  2. You may want to rebase with your master to avoid having unrelated changes. Seeing some of changes unrelated to your PR.

Thanks!

@lipingxue
Copy link
Contributor Author

@shuklanirdesh82
Unit test related change is in "vmdkops_admin_test.py"
Some minor changes made in other file does not related to unit test, but I still want to keep them in the PR, since those changes improve the readability.

I have already rebase with the master and there is no conflicts with the base branch.

@shuklanirdesh82
Copy link
Contributor

Thanks @lipingxue for addressing comments and providing explanation.

You may want to squash the commit as I am seeing changes from other PRs as part of your changes.

Copy link
Contributor

@msterin msterin left a comment

Choose a reason for hiding this comment

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

Contingent on cleaning up the commit messages:

  • squash the commits
  • remove misc. irrelevant comments like "checkpoint" in commit message
  • add some explanation on what is tests, and what is not (e.g. not all error cases) to commit message.

@lipingxue lipingxue merged commit fddbbea into master Jan 11, 2017
shaominchen pushed a commit that referenced this pull request Jan 11, 2017
* Add unit test to test AdminCLI command for "tenant".
* Add unit test for AdminCLI command for "tenant vm" and "tenant access".
@kerneltime kerneltime deleted the tenant_admin_cli.liping branch January 18, 2017 18:06
@lipingxue
Copy link
Contributor Author

Fixed #830

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants