Project

Profile

Help

Task #4348

Add unit tests for the pulpcore plugin API

Added by daviddavis 9 months ago. Updated 6 months ago.

Status:
MODIFIED
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Platform Release:
Blocks Release:
Backwards Incompatible:
No
Groomed:
Yes
Sprint Candidate:
Yes
Tags:
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:
Sprint 50

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

Associated revisions

Revision 98ce4d5a View on GitHub
Added by ppicka 7 months ago

Few unittests for plugin-api

Adding unit tests for content and repository version models.

closes: #4348
https://pulp.plan.io/issues/4348

Signed-off-by: Pavel Picka <>

History

#1 Updated by daviddavis 9 months ago

  • Tags Pulp 3 added

#2 Updated by daviddavis 9 months ago

  • Description updated (diff)

#3 Updated by daviddavis 9 months ago

  • Subject changed from Add tests for the pulpcore plugin API to Add unit tests for the pulpcore plugin API

#4 Updated by daviddavis 9 months ago

  • Description updated (diff)

#5 Updated by bmbouter 9 months 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.

#6 Updated by mdellweg 9 months 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.

#7 Updated by ttereshc 8 months ago

  • Sprint set to Sprint 49

#8 Updated by rchan 8 months ago

  • Sprint changed from Sprint 49 to Sprint 50

#9 Updated by ppicka 7 months ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to ppicka

#10 Updated by daviddavis 7 months 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 coverage0 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

#11 Updated by ppicka 7 months 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.

#12 Updated by ppicka 7 months ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100

#13 Updated by daviddavis 6 months ago

  • Sprint/Milestone set to 3.0

#14 Updated by bmbouter 6 months ago

  • Tags deleted (Pulp 3)

Please register to edit this issue

Also available in: Atom PDF