Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrataConnection Filter helper method - WIP #195

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

yazug
Copy link
Collaborator

@yazug yazug commented Apr 20, 2020

the get_filter helper method encapsulates how to query ET using standard filter pattern, where you only have to specify method call instead of string manipulation to generate the query url to send

Related: #132

errata_tool/tests/test_filter.py Outdated Show resolved Hide resolved
errata_tool/tests/test_filter.py Outdated Show resolved Hide resolved
errata_tool/tests/test_filter.py Show resolved Hide resolved
errata_tool/tests/test_filter.py Outdated Show resolved Hide resolved
errata_tool/tests/test_filter.py Outdated Show resolved Hide resolved
errata_tool/tests/test_filter.py Outdated Show resolved Hide resolved
errata_tool/tests/test_filter.py Outdated Show resolved Hide resolved
errata_tool/tests/test_filter.py Outdated Show resolved Hide resolved
@yazug yazug self-assigned this Apr 27, 2020
errata_tool/connector.py Outdated Show resolved Hide resolved
@yazug yazug force-pushed the filter_test branch 2 times, most recently from d20904d to 0c35a5e Compare April 27, 2020 21:04
@@ -310,3 +310,37 @@ def get_paginated_data(self, api_url):
if page_number >= PAGE_LIMIT:
raise RuntimeError('hit pagination timeout: %d' % page_number)
return data

def get_filter(self, endpoint, filter_arg, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "filter_arg" is always going to be the string "filter", right? Do we need this variable here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no it is not see '/errata' ... filter_args == 'errata_filter[filter_params]'

yazug@3a2bbad#diff-1a50735487483ddcd06dc38f02e580ebR379-R384

for a couple of examples, I used, extracted from various places where searching was done.

expose a general filter helper method to format kwargs up
as parameters for ET filter request. Then return generated
json object
"""
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably include the syntax for how the url is generated

- helper method to implement general filter query pattern
- add support for release/product difference in nesting filter
  parameters
- support for paginated requests
- basic unittest for filter helper based on usage

Works with the following

et.get_filter('/api/v1/releases', 'filter', is_active="true",
	  enabled="true", name='OpenStack 14.0.z for RHEL 7')

works with the following
et.get_filter('/errata', 'errata_filter[filter_params]',
	  show_type_RHBA=1, show_type_RHEA=1, show_type_RHSA=1,
	  show_state_NEW_FILES=1, show_state_QE=1,
          show_state_REL_PREP=1,show_state_PUSH_READY=1,
          open_closed_option='exclude', release=856)

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
- replaced duplicated filter query with method
  ErrataConnector::get_filter
- replaced duplicated filter query with method
  ErrataConnector::get_filter
- fixup unittests to use paginated api
- add fixture symlinks for external_tests api
@yazug yazug changed the title ErrataConnection Filter helper method ErrataConnection Filter helper method - WIP Oct 20, 2020
WIP usage of implemented ErrataConnector::get_filter and other helpers
- get_releases_for_product
- get_open_advisories_for_release
- get_open_advisories_for_release_filter

Note: errata endpoint releases and products have to be special
handled to include extra [] and multiple entries if you want them

Related: red-hat-storage#132
Extracted and extrapolated based on shale implementation
@openshift-ci
Copy link

openshift-ci bot commented Sep 9, 2021

@yazug: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants