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
Test independent on Job class #4429
Conversation
Hi @richtja , I've looked and tested the code, and this looks to be in the right direction. It will be a relief to finally get rid of the test -> job dependency. Anyway, what we need here though, is a compatibility handling strategy. Basically, by changing the signature of the For instance, this would be needed to get Avocado-VT working with this change: diff --git a/avocado_vt/test.py b/avocado_vt/test.py
index c518d8824..f6d147833 100644
--- a/avocado_vt/test.py
+++ b/avocado_vt/test.py
@@ -85,7 +85,7 @@ class VirtTest(test.Test):
env_version = utils_env.get_env_version()
def __init__(self, methodName='runTest', name=None, params=None,
- base_logdir=None, job=None, runner_queue=None,
+ base_logdir=None, config=None, runner_queue=None,
vt_params=None):
"""
:note: methodName, name, base_logdir, job and runner_queue params
@@ -112,7 +112,7 @@ class VirtTest(test.Test):
self.background_errors.clear()
super(VirtTest, self).__init__(methodName=methodName, name=name,
params=params,
- base_logdir=base_logdir, job=job,
+ base_logdir=base_logdir, config=config,
runner_queue=runner_queue)
self.builddir = os.path.join(self.workdir, 'backends',
vt_params.get("vm_type", ""))
But then, it would only work with Avocado versions containing the change you're proposing. A better version of such a patch would handle the different signatures. I suggest you do the following next:
This way, we'd make sure the compatibility is kept with all previous versions, and will be kept when your proposal (this PR) is merged. |
@clebergnu thanks for your suggestions. I will do that. |
In the avocado 86.0 will be removed the test -> job dependency. This commit will ensure the compatibility of avocado-vt with avocado>=86 Reference:avocado-framework/avocado#4429 Signed-off-by: Jan Richter <jarichte@redhat.com>
a800a3e
to
b4e6451
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.
I have a few very superficial comments and questions regarding this PR, mostly things that arose from the VT-side PR.
The job this test is associated with | ||
""" | ||
return self.__job | ||
|
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.
Good riddance btw
output_check_record = self.job.config.get('run.output_check_record') | ||
output_check = self.job.config.get('run.output_check') | ||
output_check_record = self.__config.get('run.output_check_record') | ||
output_check = self.__config.get('run.output_check') |
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 assume self.__config
will now always be checked? Simpler logic like this is definitely better.
@@ -92,6 +92,8 @@ def sigterm_handler(signum, frame): # pylint: disable=W0613 | |||
instance.set_runner_queue(queue) | |||
early_state = instance.get_state() | |||
early_state['early_status'] = True | |||
early_state['job_logdir'] = job.logdir |
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.
Is this the new way to access the job logdir from a given test? It seems to me that the job is still very much involved in the test instances and its presence was changed from an attribute to a few keys of the mangled config
attribute. I guess it is still better to get rid of the instance though.
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.
Yes in the legacy runner the job is involved in the test instance. This PR is part of preparations for deprecating the legacy runner and make test class independent in nrunner. When we deprecate the legacy runner we will get rid of those.
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.
These changes are no doubt good, my comments are mostly meta.
In the avocado 86.0 will be removed the test -> job dependency. This commit will ensure the compatibility of avocado-vt with avocado>=86 Reference:avocado-framework/avocado#4429 Signed-off-by: Jan Richter <jarichte@redhat.com>
This commit removes the Job instance from the Test class. This is preparation for legacy runner removal. For the nrunner doesn't make sense to have Test dependent on Job instance, because Test is run inside runner separated from Job. Reference: avocado-framework#4425 Signed-off-by: Jan Richter <jarichte@redhat.com>
Signed-off-by: Jan Richter <jarichte@redhat.com>
b4e6451
to
aab4af7
Compare
Code Climate has analyzed commit aab4af7 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 47.7% (50% is the threshold). This pull request will bring the total coverage in the repository to 70.3% (0.0% change). View more on Code Climate. |
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.
LGTM
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.
LGTM, thanks!
This commit removes the Job instance from the Test class. This is
preparation for legacy runner removal. For the nrunner doesn't make
sense to have Test dependent on Job instance, because Test is run inside
runner separated from Job.
Reference: #4425
Signed-off-by: Jan Richter jarichte@redhat.com