Project

Profile

Help

Test #5180

closed

Test scenario for filtering fields with created_resources

Added by lmjachky over 5 years ago. Updated about 5 years ago.

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

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"CLOSED - CURRENTRELEASElmjachkyActions

Also available in: Atom PDF