Skip to content

Conversation

fredden
Copy link
Member

@fredden fredden commented May 9, 2023

Description

While working on Ethan3600/magento2-CronjobManager#122, I noticed that providing asking Magento to validate a cron expression which contains /0 resulted in a Fatal error, rather than an exception which I could catch. This pull request fixes the divide-by-zero bug and instead produces a sensible exception. Includes unit test.

Manual testing scenarios

  1. Call \Magento\Cron\Model\Schedule::matchCronExpression('0/0', 0)

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)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Resolved issues:

  1. resolves [Issue] Avoid divide-by-zero fatal error #37804: Avoid divide-by-zero fatal error
@m2-assistant
Copy link

m2-assistant bot commented May 9, 2023

Hi @fredden. Thank you for your contribution!
Here are some useful tips on 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
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@m2-github-services m2-github-services added Partner: Youwe partners-contribution Pull Request is created by Magento Partner labels May 9, 2023
@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Bravo engcom-Bravo added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label May 11, 2023
@engcom-Hotel
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@ihor-sviziev ihor-sviziev added the Auto-Tests: Covered All changes in Pull Request is covered by auto-tests label May 25, 2023
@engcom-Lima
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Lima
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

@magento run WebAPI Tests,Static Tests,Functional Tests EE,Functional Tests CE,Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

✔️ QA Passed

Manual testing scenario:
1. Call \Magento\Cron\Model\Schedule::matchCronExpression('0/0', 0)

Before: ✖️ Throws error
image

After: ✔️ Throws Exception
image

Builds are failed. Hence, moving this PR to Extended Testing.

@engcom-Echo
Copy link
Contributor

@magento run WebAPI Tests,Functional Tests EE,Functional Tests CE,Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

@magento create issue

@engcom-Echo
Copy link
Contributor

@magento run WebAPI Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

@magento run WebAPI Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

Failing test does not seems to be related to PR changes. Hence moving it to merge in progress

@engcom-Echo
Copy link
Contributor

@magento run all test

@magento-automated-testing
Copy link

Failed to run the builds. Please try to re-run them later.

@engcom-Echo
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

@magento run Functional Tests EE , Functional Tests CE, Functional Tests B2B, Integration Tests,Unit Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

Functional Tests EE,Functional Tests CE Failures are different on last two run on same commit.Other Build Failure are not related to PR changes.
Functional Tests EE
Run1
37479-ee

Run2
Screenshot 2023-08-18 at 2 35 48 PM

Functional Tests CE
Run1
37479-ce

Run2
Screenshot 2023-08-18 at 2 35 35 PM

@magento-devops-reposync-svc magento-devops-reposync-svc merged commit 7299b6f into magento:2.4-develop Aug 31, 2023
@fredden fredden deleted the divide-by-zero-fatal-error branch August 31, 2023 12:43
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 Partner: Youwe partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept Project: Community Picked PRs upvoted by the community Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
9 participants