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

[incubator-kie-issues-834] Support Dynamic GraphQL query registering in Data Audit #1962

Merged
merged 14 commits into from
Feb 1, 2024

Conversation

elguardian
Copy link
Contributor

@elguardian elguardian commented Jan 19, 2024

data-audit/README.md Outdated Show resolved Hide resolved
}

}

Copy link
Contributor

Choose a reason for hiding this comment

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

I think what users might need here is an additional DELETE endpoint to clean up any queries that have been incorrectly registered or are no longer needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this will be addressed in another issue.

@kie-ci3
Copy link
Contributor

kie-ci3 commented Jan 24, 2024

PR job #4 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-apps -u #1962 --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/test/job/mcimbalek/job/kogito/job/main/job/pullrequest_jobs/job/kogito-apps-pr/job/PR-1962/4/display/redirect

Test results:

  • PASSED: 2857
  • FAILED: 1

Those are the test failures:

org.kie.kogito.app.audit.quarkus.QuarkusAuditQueryRegistryServiceTest.testRegisterQueryWithDateTime
Expected size: 1 but was: 6 in:
[{"eventDate"="2024-01-24T15:03:31.385Z", "eventId"="15ba01c1-2152-4699-9243-dd6c91315e0f"},
{"eventDate"="2024-01-24T15:03:32.275Z", "eventId"="47755a29-3373-4f61-a050-ff981c58145f"},
{"eventDate"="2024-01-24T15:03:31.438Z", "eventId"="7efb595a-58a4-4d5f-bd81-b0a1752d6733"},
{"eventDate"="2024-01-24T15:03:31.442Z", "eventId"="a81f8c5e-899a-47ce-bb4c-7bc439c48cae"},
{"eventDate"="2024-01-24T15:03:31.445Z", "eventId"="ae6f9ea7-0510-41a7-b099-ab3d8215b9a7"},
{"eventDate"="2024-01-24T15:03:31.457Z", "eventId"="283f92be-244f-41c0-b9af-25ec0d84b955"}]

@kie-ci3
Copy link
Contributor

kie-ci3 commented Jan 24, 2024

PR job #5 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-apps -u #1962 --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-apps-pr/job/PR-1962/5/display/redirect

Test results:

  • PASSED: 2857
  • FAILED: 1

Those are the test failures:

org.kie.kogito.app.audit.quarkus.QuarkusAuditQueryRegistryServiceTest.testRegisterQueryWithDateTime
Expected size: 1 but was: 6 in:
[{"eventDate"="2024-01-24T15:00:53.568Z", "eventId"="80a1759f-eee3-43d2-86cd-0ec164ab8794"},
{"eventDate"="2024-01-24T15:00:54.458Z", "eventId"="dc68c298-3c16-4c85-9b2c-183150f30d0e"},
{"eventDate"="2024-01-24T15:00:53.625Z", "eventId"="6ed3bca5-2b31-4616-80fc-180806f53037"},
{"eventDate"="2024-01-24T15:00:53.629Z", "eventId"="b6aeb95a-0268-4253-81ad-69ba42969475"},
{"eventDate"="2024-01-24T15:00:53.632Z", "eventId"="7185e815-5f9d-4a2c-baa1-2d746d1cd36c"},
{"eventDate"="2024-01-24T15:00:53.644Z", "eventId"="e259817a-9852-4937-9933-ab8bdad22062"}]

@pefernan
Copy link
Contributor

@elguardian look at #1962 (comment) I'm also facing same issue locally

Copy link
Contributor

@pefernan pefernan left a comment

Choose a reason for hiding this comment

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

Dropped a suggestion regarding a method name, the only issue I have is regarding the broken tests I mention on my previous comment.

Other than I'm ok with the PR as it is.

@kie-ci3
Copy link
Contributor

kie-ci3 commented Jan 24, 2024

PR job #6 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-apps -u #1962 --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-apps-pr/job/PR-1962/6/display/redirect

Test results:

  • PASSED: 2854
  • FAILED: 3

Those are the test failures:

org.kie.kogito.index.ProcessDataIndexMongoDBIT.testProcessInstanceEvents 1 expectation failed.
JSON path errors doesn't match.
Expected: null
Actual: <[{message=Exception while fetching data (/UserTaskInstances[0]/schema) : Runtime service URL not defined, please review the kogito.service.url system property to point the public URL for this runtime., locations=[{line=1, column=85}], path=[UserTaskInstances, 0, schema], extensions={classification=DataFetchingException}}]>
org.kie.kogito.app.audit.quarkus.QuarkusAuditQueryRegistryServiceTest.testRegisterQueryWithDateTime
Expected size: 1 but was: 6 in:
[{"eventDate"="2024-01-24T18:35:37.901Z", "eventId"="2102ff47-7a30-4c6b-b78f-5ed718339f8e"},
{"eventDate"="2024-01-24T18:35:39.115Z", "eventId"="6f9bdacf-119a-4990-8d19-f082ab61e0f9"},
{"eventDate"="2024-01-24T18:35:37.975Z", "eventId"="f98f47bd-0669-46e3-be1f-13b7b11edc92"},
{"eventDate"="2024-01-24T18:35:37.980Z", "eventId"="e4557dda-6015-4504-99b6-e047f33dcc4e"},
{"eventDate"="2024-01-24T18:35:37.985Z", "eventId"="4b538011-5c45-42be-b11a-626fe3eade64"},
{"eventDate"="2024-01-24T18:35:37.999Z", "eventId"="d92de807-cc92-4645-8f11-334bb9a05c0c"}]
org.kie.kogito.trusty.service.common.KeycloakTrustyServiceIT.(?) java.lang.RuntimeException: Failed to start quarkus

@martinweiler
Copy link
Contributor

QuarkusAuditQueryRegistryServiceTest passes if it is run in isolation, but fails if run within the whole testsuite, so it seems the issue is related to data cleanup across tests.

I opened up apache/incubator-kie-issues/issues/857 to capture the need for a delete endpoint.

}

@Route(path = DATA_AUDIT_QUERY_PATH, type = Route.HandlerType.BLOCKING, order = 2, methods = { GET })
public void blockingGraphQLHandlerGet(RoutingContext rc) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@elguardian what is the purpose of the GET method for the query path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we needed a way to verify that graphQL schema. If you add a new graphql query we needed a way to know the schema as it is build dynamically.

Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't completely understand what this endpoint should return. It returns a 400 error in my tests due to a missing query.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, probably you should update. It return a graphQL schema combining everything it jas within the jars plus the queries registered. try again.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does the test I added below work for you?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that will fail because that is the query path and you need the query string. If you want to test this endpoint
?query=....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will remove it to avoid confusion.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that having this GET to enable get the schema is a good idea. This will be helpful when we build tooling around the data-audit graphql interface.

IMO I wouldn't completely remove it, maybe we could enable it in dev mode.

Copy link
Contributor

Choose a reason for hiding this comment

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

My bad, I should have paid more attention. +1 to keep it in, but maybe with a test case or additional explanation in the README on how to use it.

Copy link
Contributor

@martinweiler martinweiler left a comment

Choose a reason for hiding this comment

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

Great work @elguardian

@elguardian elguardian merged commit 5bd2b09 into apache:main Feb 1, 2024
5 checks passed
@elguardian elguardian deleted the incubator-kie-issues-834 branch February 1, 2024 08:03
rgdoliveira pushed a commit to rgdoliveira/kogito-apps that referenced this pull request Feb 5, 2024
…in Data Audit (apache#1962)

[incubator-kie-issues-834] Support Dynamic GraphQL query registering in Data Audit
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.

Support Dynamic GraphQL query registering in Data Audit
4 participants