Task #4348
closedAdd unit tests for the pulpcore plugin API
100%
Description
Beyond some unit tests for the Stages API stuff, we have no Plugin API unit tests. The Galaxy team has asked us to make sure that we are testing the parts of the plugin API that they use. So at a minimum we need to cover:
- Plugin registration (ie a test to ensure that a plugin can register with Pulp and Pulp is then aware of the plugin)
-
Content
can be subclassed and CRUDed -
Publisher
can be subclassed and CRUDed -
Publications
can be CRDed by the plugin -
Distributions
can be CRUDed by the plugin - Plugin content can be served by the Content App
Updated by daviddavis almost 6 years ago
- Subject changed from Add tests for the pulpcore plugin API to Add unit tests for the pulpcore plugin API
Updated by bmbouter almost 6 years ago
- Groomed changed from No to Yes
- Sprint Candidate changed from No to Yes
This task description makes sense to me. I think it's OK so I'm grooming it and making sprint candidate.
Updated by mdellweg almost 6 years ago
Maybe this crazy idea is going a little too far, but if we did those unit tests with an on-the-fly instantiation of the plugin-template, we could kill two birds with one stone.
Updated by ppicka almost 6 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to ppicka
Updated by daviddavis over 5 years ago
It sounds like these tests won't be possible without somehow setting up an appconfig which can't be done AFAICT on the fly:
ImportError: Failed to import test module: models.test_publisher
Traceback (most recent call last):
File "/usr/lib64/python3.6/unittest/loader.py", line 428, in _find_test_path
module = self._get_module_from_name(name)
File "/usr/lib64/python3.6/unittest/loader.py", line 369, in _get_module_from_name
__import__(name)
File "/home/vagrant/devel/pulpcore-plugin/pulpcore/tests/unit/models/test_publisher.py", line 9, in <module>
class TempClass2(Publisher):
File "/usr/local/lib/pulp/lib64/python3.6/site-packages/django/db/models/base.py", line 95, in __new__
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class models.test_publisher.TempClass2 doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
We have indirect coverage[0] of the pulpcore plugin API already so I'm tempted to close this as WONTFIX.
[0] https://github.com/pulp/pulpcore/tree/master/pulpcore/tests/functional/api/using_plugin
Updated by ppicka over 5 years ago
- Status changed from ASSIGNED to POST
https://github.com/pulp/pulpcore-plugin/pull/78
I went through https://github.com/pulp/pulpcore/tree/master/pulpcore/tests/functional/api/using_plugin which cover other stuffs pretty well.
For app registration is enough to run any basic test from any plugin as its basic operation at pulp start and cannot be tested at runtime.
Updated by ppicka over 5 years ago
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
Applied in changeset commit:pulpcore-plugin|98ce4d5a0522ef851b8efe4622ddf4617e790b7a.
Updated by bmbouter about 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE