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

test(sql): Test fix for incorrect running instances count in process … #4752

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mboskamp
Copy link
Member

@mboskamp mboskamp commented Oct 30, 2024

Context: The query selectPDStatistics calculates the total processInstances wrong.
Used-by: ProcessDefinitionRestService#getStatisticsCount

Why: The group by incidentType part of the query should not be used for counting the total process instances.

Tests: The commit adds a test which expects the correct statistics returned when process instances related to incidents with different types are used.

Related-to: https://jira.camunda.com/browse/SUPPORT-24279
#4756

@psavidis
Copy link
Contributor

psavidis commented Dec 18, 2024

Reviewer Hints

Added a test which verifies the correctness of statistics for the issue reproduction case

  • The test fails when the fix commit is not effective (rolled-back, dropped etc)
  • The test passes when the fix is applied
  • The test passes against the CI (ref)
  • Merge PR

@psavidis psavidis added ci:webapp-integration Runs the webapp integration builds. and removed ci:all-db Runs the builds for all databases. labels Dec 18, 2024
@psavidis psavidis marked this pull request as ready for review December 18, 2024 20:12
@psavidis psavidis added ci:default-build Runs the builds that have no explicit trigger (e.g. different history levels). ci:h2 Runs the builds for the H2 database. ci:run Runs the integration tests for the Run distribution. labels Dec 18, 2024
@psavidis psavidis assigned psavidis and unassigned mboskamp Dec 18, 2024
@psavidis psavidis requested a review from venetrius December 18, 2024 20:16
@@ -101,7 +101,6 @@
(
select
I.PROC_DEF_ID_
, I.INCIDENT_TYPE_
Copy link
Contributor

Choose a reason for hiding this comment

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

Context: Incident type is removed from the query's select, group by

@@ -392,4 +393,73 @@ public void shouldSortResult() {
verifyOrderedResult("incidents", "asc", Arrays.asList("p2", "B", "p1", "A"));
verifyOrderedResult("incidents", "desc", Arrays.asList("A", "p1", "B", "p2"));
}

@Test
public void shouldReturnCorrectStatistics() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Context: Test that covers the correct statistics calculation for process instances with incidents (different types)

Copy link
Member

@venetrius venetrius left a comment

Choose a reason for hiding this comment

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

👍
Verified that test would fail without the included query changes.
Really well written test case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:default-build Runs the builds that have no explicit trigger (e.g. different history levels). ci:h2 Runs the builds for the H2 database. ci:run Runs the integration tests for the Run distribution. ci:webapp-integration Runs the webapp integration builds.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants