Project

Profile

Help

Task #6512

closed

Add a PULP_UNDER_TEST setting that can enable viewsets and additional RQ tasks

Added by bmbouter about 4 years ago. Updated over 3 years ago.

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

0%

Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

Motivation

Here are a few challenges that came up recently that we haven't been able to solve:

  • We wanted to test parent/child feature of pulpcore, but we couldn't because we couldn't write test tasks that provide basic exercising of the functionality.

  • pulp_ansible has scale testing tasks which need can only be called if RQ workers discover them during their normal startup. As it is these tasks are actually runable on production environments.

  • The migration plugin calls an the RPM publish task synchronously and not from the usual viewset that dispatches an RPM publication. The normal viewset contains assumptions which prevent a good test us from calling it like usual because that's not how the migration plugin code will use it. Thus we need "a test viewset" and a "test task" which can mimic how the migration plugin calls the task syncronously to create the publication.

Solution

Create an optional import codepath for pulpcore viewsets and RQ tasks. If the PULP_UNDER_TEST setting is equal to True then the test_viewset.py and test_tasks.py modules are loaded and if unset or set to anything other than True are not imported. This would be done using import_module.

Also available in: Atom PDF