Skip to content

Fix issue with products GET request being cached despite category positions change #30636

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

Conversation

Zifius
Copy link
Member

@Zifius Zifius commented Oct 24, 2020

Description (*)

Fixes issue with products GET request being cached despite category positions change

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes Products positions are not updated in GraphQL query result #30467

Manual testing scenarios (*)

Described in the original issue

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

"in" condition not tested
@m2-assistant
Copy link

m2-assistant bot commented Oct 24, 2020

Hi @Zifius. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@rogyar rogyar added the Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests label Oct 24, 2020
@ghost ghost added Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Oct 24, 2020
@rogyar
Copy link
Contributor

rogyar commented Oct 24, 2020

@Zifius please, feel free to ping me if you need any help with that.

@rogyar rogyar self-assigned this Oct 24, 2020
@cpartica
Copy link
Contributor

cpartica commented Nov 3, 2020

@Zifius your fix looks good, you should open the PR and complete a test.
I think there's some integration tests done on tags as inspiration

@@ -79,6 +79,11 @@ public function resolve(
'layer_type' => isset($args['search']) ? Resolver::CATALOG_LAYER_SEARCH : Resolver::CATALOG_LAYER_CATEGORY,
];

if (isset($args['filter'])) {
Copy link
Contributor

Choose a reason for hiding this comment

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

you only need some tests, fix looks good

@ghost ghost assigned cpartica Nov 3, 2020
@Zifius
Copy link
Member Author

Zifius commented Nov 9, 2020

Thanks @cpartica, unfortunately community slack doesn't keep the history of our 1to1 chat, so the question is would you prefer changing \Magento\GraphQl\Catalog\ProductSearchTest::testSortByPosition() (https://github.com/magento/magento2/blob/2.4-develop/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php#L1114) which seems to be testing exactly this functionality but currently passing (I suppose the test is incomplete or incorrect, but need to debug it to see what's really going on there) or creating a new test?

@rogyar
Copy link
Contributor

rogyar commented Nov 12, 2020

Just from my point of view, I would suggest adjusting an existing test case instead of introducing a new one with a very similar purpose.

Not sure my assumption makes sense. But the existing test might work and the reason for that is utilizing disk/Redis cache for FPC instead of Varnish. But I might be wrong.

@cpartica
Copy link
Contributor

cpartica commented Nov 23, 2020

Just from my point of view, I would suggest adjusting an existing test case instead of introducing a new one with a very similar purpose.

Not sure my assumption makes sense. But the existing test might work and the reason for that is utilizing disk/Redis cache for FPC instead of Varnish. But I might be wrong.

Yes we can't test Varnish yet, but we sure can do disk builtin cache with the help of integration tests
example: \Magento\GraphQlCache\Controller\Catalog\CategoryCacheTest

@Zifius Zifius marked this pull request as ready for review November 26, 2020 21:02
@Zifius
Copy link
Member Author

Zifius commented Nov 26, 2020

Thank you @rogyar and @cpartica both for the replies. I've now created the test

@Zifius
Copy link
Member Author

Zifius commented Nov 26, 2020

@magento run WebAPI Tests

@rogyar
Copy link
Contributor

rogyar commented Nov 27, 2020

@magento run WebAPI Tests

@engcom-Charlie engcom-Charlie self-assigned this Nov 30, 2020
@engcom-Charlie
Copy link
Contributor

@magento run all tests

@Zifius
Copy link
Member Author

Zifius commented Nov 30, 2020

@magento run Integration Tests

@Zifius
Copy link
Member Author

Zifius commented Nov 30, 2020

@magento run all tests

@rogyar rogyar added Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: bug fix Award: test coverage and removed Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests labels Dec 1, 2020
Copy link
Contributor

@rogyar rogyar left a comment

Choose a reason for hiding this comment

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

Approved. The failing functional tests are not related to the current changeset.

@magento-engcom-team
Copy link
Contributor

Hi @rogyar, thank you for the review.
ENGCOM-8504 has been created to process this Pull Request

@magento-engcom-team magento-engcom-team merged commit 13b7186 into magento:2.4-develop Dec 4, 2020
@m2-assistant
Copy link

m2-assistant bot commented Dec 4, 2020

Hi @Zifius, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: bug fix Award: test coverage Component: CatalogGraphQl Event: MageCONF CD 2020 Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: ready for testing Project: GraphQL Release Line: 2.4 Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Products positions are not updated in GraphQL query result
8 participants