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

CUMULUS-3697: Remove searchContext from granules LIST endpoint ( Jk/cumulus 3697 update api) #3863

Open
wants to merge 4 commits into
base: feature/es-phase-2
Choose a base branch
from

Conversation

Jkovarik
Copy link
Member

Summary: Summary of changes

Addresses CUMULUS-3697

Changes

  • CUMULUS-3967
    • Remove searchContext from API granules GET /granules endpoint.
    • Update relevant tests to validate expected behavior utilizing postgres pagination

PR Checklist

  • Update CHANGELOG
  • Unit tests
  • Ad-hoc testing - Deploy changes and test manually
  • Integration tests

@Jkovarik Jkovarik changed the base branch from master to feature/es-phase-2 November 19, 2024 17:22
Copy link
Contributor

@npauzenga npauzenga left a comment

Choose a reason for hiding this comment

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

Looks great @Jkovarik! Very glad we didn't actually need a replacement for searchContext.

One broader question about scope on this ticket: can/should we remove the searchContext param from es-client? I don't think it's used elsewhere so maybe we can remove it everywhere?

const response = await request(app)
.get('/granules?limit=100&page=101')
.set('Accept', 'application/json')
.expect(200);
Copy link
Contributor

Choose a reason for hiding this comment

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

What would this return if you specified a page that doesn't exist? e.g. get('/granules?limit=100&page=99999999')?

Wondering if the API would happily return a successful response for a blank, out-of-range page, or if it'd return something different. If something different, 👍. If there's a possibility you could get a 200 but no results or something, maybe we validate results?

Copy link
Member Author

Choose a reason for hiding this comment

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

If, for example, you ask for page 102, it returns no results.

I suppose we could return something more intelligent on pagination (we're not currently in that endpoint as delivered). If you think it's worthwhile I can look into what ES does, but I'd expect it's consistent given our implementation strategy.

Copy link
Contributor

Choose a reason for hiding this comment

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

My only concern here is the test itself. We're requesting page 101, which presumably contains results and returns a 200. What if it didn't have results? I... assume... it would return something other than 200?

In other words, is a 200 response indicative of actual results returned?

Copy link
Member Author

@Jkovarik Jkovarik Nov 20, 2024

Choose a reason for hiding this comment

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

I think the 200 assertion here just is a catch in case the API throws to make the test easier to read if it does not. We could remove it to the same effect, just would make the test more unclear if the API unexpectedly fails.

The functional test is that it returned the last page, with 1 granule (t.is(response.body.results.length, 1);)

Copy link
Contributor

Choose a reason for hiding this comment

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

OHHHHHHH ha

Ok, so waaaaaaayyyyy down after all the removals you have the assertion you point out t.is(response.body.results.length, 1);. That makes a lot more sense 😆. I didn't see that and thought we were saying the 200 proved that it's returning results.

Ok, I'm good.

@Jkovarik
Copy link
Member Author

@npauzenga "One broader question about scope on this ticket: can/should we remove the searchContext param from es-client? I don't think it's used elsewhere so maybe we can remove it everywhere?"

We could, but I believe that's the subject of a broader ticket to remove it entirely.

@npauzenga
Copy link
Contributor

@npauzenga "One broader question about scope on this ticket: can/should we remove the searchContext param from es-client? I don't think it's used elsewhere so maybe we can remove it everywhere?"

We could, but I believe that's the subject of a broader ticket to remove it entirely.

Meaning, that ticket already exists? I don't see one but I'm also not looking super hard 😆.

I'm thinking it should be an easy thing to do if it's not used anywhere else. That could be grossly optimistic and if a ticket already exists, that's cool.

@Jkovarik
Copy link
Member Author

@npauzenga @charleshuang80 has CUMULUS-3847, which I thought would cover it.

Copy link
Contributor

@npauzenga npauzenga left a comment

Choose a reason for hiding this comment

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

Thanks @Jkovarik! This looks great to me! Approved assuming the removal of the rest of searchContext is covered elsewhere.

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