Project

Profile

Help

Test #5180

Test scenario for filtering fields with created_resources

Added by lmjachky 3 months ago. Updated 9 days ago.

Status:
CLOSED - COMPLETE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Version:
Platform Release:
Tags:
Sprint:

Description

The pull request https://github.com/pulp/pulpcore/pull/228 fixes the issue which prevents users to fetch references to newly created resources while requesting only one field within a filter - created_resources.

A following test scenario may be used for testing:

1. Run the script 2 times in order to create two different tasks in a database:

BASE_ADDR=http://localhost:24817

http POST $BASE_ADDR/pulp/api/v3/remotes/rpm/rpm/ name='epel7-x86_64' url='https://dl.fedoraproject.org/pub/epel/7/x86_64/' policy='immediate'
http POST $BASE_ADDR/pulp/api/v3/repositories/ name='epel7-x86_64'
export REMOTE_HREF=$(http $BASE_ADDR/pulp/api/v3/remotes/rpm/rpm/ | jq -r '.results[] | select(.name == "epel7-x86_64") | ._href')
export REPO_HREF=$(http $BASE_ADDR/pulp/api/v3/repositories/ | jq -r '.results[] | select(.name == "epel7-x86_64") | ._href')
http POST $BASE_ADDR${REMOTE_HREF}sync/ repository=$REPO_HREF

2. Wait until the tasks are successfully completed and a reference to a corresponding created resource is updated:

http http://localhost:24817/pulp/api/v3/tasks/{TASK_ID}/

3. Build a request which will filter out all fields except created_resources:

http http://localhost:24817/pulp/api/v3/tasks/?fields=created_resources

{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "created_resources": [
                "/pulp/api/v3/repositories/e8251e9c-ef26-4dbe-a6fc-2b40c186d464/versions/2/" 
            ]
        },
        {
            "created_resources": [
                "/pulp/api/v3/repositories/e8251e9c-ef26-4dbe-a6fc-2b40c186d464/versions/1/" 
            ]
        }
    ]
}

4. Check if correct repository versions were returned in the response.


Related issues

Related to Pulp - Issue #4722: Using the "fields=" feature has strange behavior with "created_resources" MODIFIED Actions

Associated revisions

Revision 36f6375d View on GitHub
Added by Lubos Mjachky 2 months ago

Add test for filtering created_resources field

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

History

#1 Updated by lmjachky 2 months ago

  • Status changed from NEW to POST
  • Assignee set to lmjachky

#2 Updated by Anonymous 2 months ago

  • Status changed from POST to MODIFIED

#3 Updated by kersom 2 months ago

  • Related to Issue #4722: Using the "fields=" feature has strange behavior with "created_resources" added

#4 Updated by kersom 9 days ago

  • Status changed from MODIFIED to CLOSED - COMPLETE

Please register to edit this issue

Also available in: Atom PDF