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

[Fix_3818] Wrong calculation in test rollCalendarAfterHolidays if day is near to end-of-year #3819

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gmunozfe
Copy link
Contributor

Many thanks for submitting your Pull Request ❤️!

Closes/Fixes/Resolves #3818

Description: Wrong calculation in test rollCalendarAfterHolidays if day is near to end-of-year

How to replicate CI configuration locally?

Build Chain tool does "simple" maven build(s), the builds are just Maven commands, but because the repositories relates and depends on each other and any change in API or class method could affect several of those repositories there is a need to use build-chain tool to handle cross repository builds and be sure that we always use latest version of the code for each repository.

build-chain tool is a build tool which can be used on command line locally or in Github Actions workflow(s), in case you need to change multiple repositories and send multiple dependent pull requests related with a change you can easily reproduce the same build by executing it on Github hosted environment or locally in your development environment. See local execution details to get more information about it.

BusinessCalendarImpl.rollCalendarAfterHolidays(calendar, holidays, weekendDays, false);
int expected = currentDayOfYear + holidayLeft + 1;
if (expected > maxDaysInYear) {
expected -= maxDaysInYear;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand the patch, but I think the test is wrong. Having an if in a test to define expected values is kind of a code smell. we should know what to expect in a test. If I understsand correclty, the issue here is that the test is not using a fixed day, but instead taking the day we are executing the test.

It is sensible to test the roll of the date, but this means we need two tests - one near the end of the year and one far from the end of the year. I suggest modifying the tests according.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point @pibizza ! I've changed to have 2 tests, with and without year rollover and setting also the year for not depending on the year (if it is or not leap year)

@gmunozfe gmunozfe requested review from ricardozanini and removed request for wmedvede December 30, 2024 16:16
@kie-ci3
Copy link
Contributor

kie-ci3 commented Dec 30, 2024

PR job #3 was: UNSTABLE
Possible explanation: This should be test failures

Reproducer

build-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-runtimes -u #3819 --skipParallelCheckout

NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution

Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3819/3/display/redirect

Test results:

  • PASSED: 3524
  • FAILED: 1

Those are the test failures:

org.jbpm.bpmn2.IntermediateEventTest.testIntermediateCatchEventTimerCycle3
expected: 3
but was: 2

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.

Wrong calculation in test rollCalendarAfterHolidays if day is near to end-of-year
4 participants