-
Notifications
You must be signed in to change notification settings - Fork 165
[1LP][RFR] Vm name enhancement - to append assignee to VM name #9186
Conversation
639689f
to
245f364
Compare
245f364
to
1fb20d3
Compare
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.
Some more comments and questions, thanks for making use of polarion_docstrings
!
cfme/common/vm.py
Outdated
try: | ||
from polarion_docstrings.parser import DocstringParser | ||
assignee = DocstringParser(request.function.__doc__).parse()["assignee"].value | ||
except TypeError: |
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.
we can remove this is we use the .get()
@john-dupuy I had chat with @mshriver he had some thoughts around moving it to Fixtures layer, he will comment on the PR shortly and I will re-work it then :) Thanks for review. |
cfme/common/vm.py
Outdated
vm = deploy_template(self.provider.key, self.name, self.template_name, **kwargs) | ||
try: | ||
from polarion_docstrings.parser import DocstringParser | ||
assignee = DocstringParser(request.function.__doc__).parse()["assignee"].value |
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.
This metadata can be defined at levels other than the function. There are new methods which merge the meta from all levels, in a given file. I'm using them in #9225
4cb2e93
to
9dcbb02
Compare
cfme/fixtures/vm.py
Outdated
@@ -11,7 +12,15 @@ | |||
|
|||
def _create_vm(request, template, provider, vm_name): | |||
collection = provider.appliance.provider_based_collection(provider) | |||
vm_obj = collection.instantiate(vm_name, provider, template_name=template.name) | |||
try: | |||
assignee = DocstringParser(request.function.__doc__).parse()["assignee"].value |
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.
With the most recent versions of the polarion tools (PR #9225 includes update) this metadata (composited from module/class/function) is available from the session.
Currently that session attribute is only populated if in collect only mode, I'm looking to change that in pytest-polarion-collect PR 5 or a followup.
This works for now for testing this functionality and designing the fixture structure, so I don't think it blocks working the rest of this PR. But ASAP this should be changed to use the pre-parsed (and composited) metadata.
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.
I have access to items and fspath through the session object. I do see nodeid too but that returns blank. I don't see what we can use to fetch the metadata as you mentioned in the comment above. I agree that once it becomes available we can use it.
n [15]: s.items
Out[15]: [<Function 'test_vm_name_postfix[virtualcenter-6.7-full_template]'>]
In [16]: s.fspath
Out[16]: local('/home/kkulkarn/git/integration_tests')
In [17]: s.nodeid
Out[17]: ''
cfme/fixtures/vm.py
Outdated
except TypeError: | ||
assignee = "" | ||
if assignee: | ||
vm_name = vm_name + "-" + assignee |
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.
I think the logic can be simplified a bit here to avoid adding these strings in a clunky way, and do it more consistently.
Consider using 'unassigned'
or something similar when its missing.
8c0eeea
to
0ab1b52
Compare
0ab1b52
to
f5c9ef8
Compare
be1ccbb
to
ab664fa
Compare
ab664fa
to
a9e368c
Compare
a9e368c
to
494c338
Compare
494c338
to
f2c6b73
Compare
f2c6b73
to
ce67052
Compare
I detected some fixture changes in commit ce67052 Show fixturesThe global fixture
The global fixture
The local fixture
The local fixture
The local fixture
The local fixture
Please, consider creating a PRT run to make sure your fixture changes do not break existing usage 😃 |
…eIQ#9186) * Extending create_on_provider method to postfix assignee to vm name * Updating the approach for getting assignee for vm name using pytest_polarion_collect * Updating minor things * Adding more tests for function scope * changing full_template_vm(_modscope) calls to create_vm(_modscope) * Fixing Travis
Purpose or Intent
Tested all affected files on jenkins 511z/job/kk-console-chrome/69/ where I replaced all full_template_vm usage with new create_vm_fixture and it passed correctly. Please review.
PRT Run