Project

Profile

Help

Task #6069

closed

Use bindings in the pulp_container functional tests

Added by lmjachky almost 3 years ago. Updated over 2 years ago.

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

100%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
No
Tags:
API Bindings
Sprint:
Sprint 67
Quarter:

Description

This task requires to rewrite all functional tests to use bindings.

To better understand how the bindings actually work, one may take a look at the following demo: https://www.youtube.com/watch?v=mFBP-M0ZPfw. The code example shown in the demo can be found here: https://github.com/pulp/pulpcore/blob/620d65ed8be7794f8e47a05b2596c02b70eb7a9b/.travis/test_bindings.py#L92-L179.

Actions #1

Updated by fao89 almost 3 years ago

0 - update your pulplift (it has an alias for installing bindings)
0.1 - pulplift automatically install the bindings for you
0.2 - if you have to generate bindings: $pbindings pulp_container python
1 - for exploring python bindings, go to ipython:
[1] from pulpcore.client import pulp_container
[2] dir(pulp_container)
[3] pulp_container.SomeClass??
2 - pulp_file example is here: https://github.com/pulp/pulp_file/pull/347/files
pulpcore example: https://github.com/pulp/pulpcore/blob/master/.travis/test_bindings.py
3 - the main difference is pulp_file has only one content type, so maybe instead of ContainerContentApi it could be something like ContainerBlobContentApi
3.1 - you'll get the names with step (1) above
4 - test_download_content has the full workflow: sync, publish, distribution
4.1 - pulp_container/tests/functional/utils.py has some methods you will need
5 - use plugin_template:
$ ./plugin-template --bootstrap pulp_container
5.1 - then discard everything but test_download_content, and maybe utils
5.1.1 - it is just a few methods introduced in utils, maybe it is better to do it manually, because plugin_template can change a lot of things,
so you decide whether to keep or discard changes made by plugin_template
6 - my approach would be: use plugin_template and check which file will need just few adjustments and which file would be better to rewrite everything manually

Actions #2

Updated by lmjachky almost 3 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to lmjachky
Actions #3

Updated by lmjachky almost 3 years ago

  • Description updated (diff)
  • Tags API Bindings added
Actions #4

Updated by fao89 almost 3 years ago

  • Description updated (diff)
Actions #5

Updated by ipanova@redhat.com almost 3 years ago

  • Groomed changed from No to Yes
  • Sprint set to Sprint 65
Actions #6

Updated by rchan almost 3 years ago

  • Sprint changed from Sprint 65 to Sprint 66
Actions #7

Updated by fao89 almost 3 years ago

we use openapi 2.0, as you can see here: https://pulp-container.readthedocs.io/en/latest/_static/api.json config_blob is a required field with string type, on openapi 2.0 you can not have both string and null types: https://stackoverflow.com/a/48114322/5253051 and if a field is required, it can not be null: https://stackoverflow.com/a/45577763/5253051

Actions #8

Updated by fao89 almost 3 years ago

I made a workaround for replacing None by empty strings, apparently, it was enough to solve the issue, but I'm not sure if it could affect other use cases. Maybe we can write a special DetailRelatedField: https://github.com/pulp/pulpcore/pull/536

Actions #9

Updated by lmjachky almost 3 years ago

  • Status changed from ASSIGNED to POST

Added by Lubos Mjachky almost 3 years ago

Revision cfa759ba

Convert functional tests to use bindings

In addition, the test test_convert.py was moved to the directory tests/unit/.

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

Added by Lubos Mjachky almost 3 years ago

Revision cfa759ba

Convert functional tests to use bindings

In addition, the test test_convert.py was moved to the directory tests/unit/.

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

Actions #10

Updated by rchan almost 3 years ago

  • Sprint changed from Sprint 66 to Sprint 67
Actions #11

Updated by Anonymous over 2 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100
Actions #12

Updated by dkliban@redhat.com over 2 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF