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

Fixes #6850 Prewarmup home in certain scenarios where it shouldn't #6881

Merged
merged 10 commits into from
Aug 23, 2024

Conversation

Khadreal
Copy link
Contributor

Description

Fixes #6850

Documentation

User documentation

Prevent pre warm_up for expired license > 15 days

Explain how this code impacts users.

Technical documentation

Add grace period and environment check for warm_up.

Type of change

  • Bug fix (non-breaking change which fixes an issue).

New dependencies

N/A

Checklists

Feature validation

  • I validated all the Acceptance Criteria. If possible, provide sreenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Documentation

  • I prepared the user documentation for the feature/enhancement and shared it in the PR or the GitHub issue.
  • The user documentation covers new/changed entry points (endpoints, WP hooks, configuration files, ...).
  • I prepared the technical documentation if needed, and shared it in the PR or the GitHub issue.

Code style

  • I wrote self-explanatory code about what it does.
  • I did not introduce unecessary complexity.

@Khadreal Khadreal added type: bug Indicates an unexpected problem or unintended behavior module: OCI Optimize Critical Images labels Aug 21, 2024
@Khadreal Khadreal self-assigned this Aug 21, 2024
@Khadreal Khadreal requested a review from a team August 21, 2024 09:34
@Khadreal Khadreal changed the base branch from develop to feature/lrc August 21, 2024 09:34
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 2cdeb581 47.86% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (2cdeb58) Report Missing Report Missing Report Missing
Head commit (6a6f334) 37791 14402 38.11%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#6881) 257 123 47.86%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

Copy link

codacy-production bot commented Aug 21, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 293c58b1 100.00% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (293c58b) Report Missing Report Missing Report Missing
Head commit (5636e39) 37955 9516 25.07%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#6881) 7 7 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@MathieuLamiot
Copy link
Contributor

MathieuLamiot commented Aug 21, 2024

@Khadreal Test coverage is still low despite your latest commit that seems to add tests on warm_up_home. According to codacy, those tests are not running.
Are you 100% sure they are correctly running? Looking at those two runs 1 / 2, I don't see number of tests changing, which makes me wonder. Are the new tests suppose to run as part of composer run-tests-general?

PS: You can access previous runs by going to the commit list of the PR, then click the ✅ (or red X) CI status of the commit you are interested in. I compared the last 2, and it seems the action Unit/Integration General tests Latest version ran the same number of tests.

@Khadreal
Copy link
Contributor Author

@Khadreal Test coverage is still low despite your latest commit that seems to add tests on warm_up_home. According to codacy, those tests are not running. Are you 100% sure they are correctly running? Looking at those two runs 1 / 2, I don't see number of tests changing, which makes me wonder. Are the new tests suppose to run as part of composer run-tests-general?

PS: You can access previous runs by going to the commit list of the PR, then click the ✅ (or red X) CI status of the commit you are interested in. I compared the last 2, and it seems the action Unit/Integration General tests Latest version ran the same number of tests.

It's part of the specific test and I can see the difference here 1 and 2
Could it be that codacy doesn't factor specific test into its coverage

@Khadreal
Copy link
Contributor Author

Khadreal commented Aug 22, 2024

I'm moving this to QA, the group test(PerformanceHints) is not captured in the codacy coverage, a quick modification to move the specific group tests to general-test seems to break the test and out of scope for this PR to cover. We'll have another issue to cover this.

Create an issue here

@MathieuLamiot
Copy link
Contributor

@Khadreal I think there is a misunderstanding with @Tabrisrp's review. The change of name makes the function do the opposite of its name, no? It returns True when it is NOT allowed. The logic seems good, but the name is very misleading.
I assume the suggested change was to change the name to is_allowed, invert what the method returns and use ! is_allowed when it is called?

Copy link
Contributor

@Mai-Saad Mai-Saad left a comment

Choose a reason for hiding this comment

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

Working fine when

  • on live env , user expired >= 15d => no fetch/prewarmup
  • on live env, user expired < 15 d => fetch is working
  • on live , user not expired => fetch is working
  • on live, rucss on then clear CI => not fetching
  • on local env => no fetch nor warmup

@MathieuLamiot MathieuLamiot merged commit 6e8d340 into feature/lrc Aug 23, 2024
11 checks passed
@MathieuLamiot MathieuLamiot deleted the fix/6850-prewarmup-home branch August 23, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: OCI Optimize Critical Images type: bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prewarmup home in certain scenarios where it shouldn't
6 participants