Task #6069
closedUse bindings in the pulp_container functional tests
100%
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.
Updated by fao89 almost 5 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
Updated by lmjachky almost 5 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to lmjachky
Updated by lmjachky almost 5 years ago
- Description updated (diff)
- Tags API Bindings added
Updated by fao89 almost 5 years ago
- Description updated (diff)
bindings tutorial by Dennis: https://ftp.osuosl.org/pub/fosdem/2020/UD2.120/openapi.mp4
Updated by ipanova@redhat.com almost 5 years ago
- Groomed changed from No to Yes
- Sprint set to Sprint 65
Updated by fao89 almost 5 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
Updated by fao89 almost 5 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
Updated by lmjachky almost 5 years ago
- Status changed from ASSIGNED to POST
Added by Lubos Mjachky almost 5 years ago
Added by Lubos Mjachky almost 5 years ago
Revision cfa759ba | View on GitHub
Convert functional tests to use bindings
In addition, the test test_convert.py was moved to the directory tests/unit/.
Updated by Anonymous almost 5 years ago
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
Applied in changeset cfa759ba3c48e691b59f68fe6bbbb866787feaf0.
Updated by dkliban@redhat.com almost 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
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