Skip to content

Conversation

@rohanpm
Copy link
Contributor

@rohanpm rohanpm commented Aug 15, 2019

Allows to search directly for e.g. "is_temporary", rather than having to know the
underlying field in which that data is stored, "notes.pub_temp_repo".

This reduces dependency on Pulp implementation details.

With the real client, if you'd passed a bad criteria object, you'd
immediately get an exception. On the fake client, you'd rather get
a future resolved with an exception.

It's best to be consistent between the two clients, so let's adjust
the fake client to also raise immediately.  We can share the real
client code to do this.
Previously, it was necessary always to use Pulp field names in
repo searches.  This was awkward, as it means the caller needs to
know and deal with both the Pulp and the model field names for
the same piece of data.

For example, to find Repository objects with eng_product_id=123,
the caller would have to know that this field is stored as a
string under "notes.eng_product", thus the model wouldn't fully
encapsulate the Pulp implementation details.

Improve this by making it possible to provide the model field
names to searches.  If the caller wants to find repositories
with (for example) eng_product_id=123, they can now directly
search with that field name and value.  This should be
preferred, as the caller no longer has to know exactly how a field
has been stored within Pulp.

However, since it's not usable under all circumstances, search
on raw Pulp fields will remain supported.
@rohanpm rohanpm requested a review from rajulkumar as a code owner August 15, 2019 10:30
@rohanpm
Copy link
Contributor Author

rohanpm commented Aug 15, 2019

@rajulkumar this is supposed to help you completely scrap the need to embed "notes.pub_temp_repo" anywhere, so it's fully encapsulated by this library.

from pubtools.pulplib._impl.client.search import filters_for_criteria


def test_eng_product_in():
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: 'test_eng_product_id'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I did mean "in" because the test is doing a search with "in" operator, though I see how it's ambiguous.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see what you mean. It's called eng_product_id, so looked like a typo.

@rohanpm rohanpm merged commit 28a29e8 into release-engineering:master Aug 15, 2019
@rohanpm rohanpm deleted the search-model-fields branch August 15, 2019 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants