Project

Profile

Help

Task #4348

closed

Add unit tests for the pulpcore plugin API

Added by daviddavis almost 6 years ago. Updated almost 5 years ago.

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

100%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
Yes
Tags:
Sprint:
Sprint 50
Quarter:

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
Actions #1

Updated by daviddavis almost 6 years ago

  • Tags Pulp 3 added
Actions #2

Updated by daviddavis almost 6 years ago

  • Description updated (diff)
Actions #3

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
Actions #4

Updated by daviddavis almost 6 years ago

  • Description updated (diff)
Actions #5

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.

Actions #6

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.

Actions #7

Updated by ttereshc almost 6 years ago

  • Sprint set to Sprint 49
Actions #8

Updated by rchan over 5 years ago

  • Sprint changed from Sprint 49 to Sprint 50
Actions #9

Updated by ppicka over 5 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to ppicka
Actions #10

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

Actions #11

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.

Actions #12

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.

Actions #13

Updated by daviddavis over 5 years ago

  • Sprint/Milestone set to 3.0.0
Actions #14

Updated by bmbouter over 5 years ago

  • Tags deleted (Pulp 3)
Actions #15

Updated by bmbouter almost 5 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF