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 test_cohereInference_withDifferent_postProcessFunction flaky test #3666

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

Conversation

nathaliellenaa
Copy link
Contributor

Description

Fix test_cohereInference_withDifferent_postProcessFunction flaky test due to

java.lang.NullPointerException: Cannot invoke "Object.getClass()" because the return value of "java.util.Map.get(Object)" is null

Related Issues

Resolves #3628 (comment)

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@nathaliellenaa nathaliellenaa temporarily deployed to ml-commons-cicd-env-require-approval March 17, 2025 19:50 — with GitHub Actions Inactive
@nathaliellenaa nathaliellenaa temporarily deployed to ml-commons-cicd-env-require-approval March 17, 2025 19:50 — with GitHub Actions Inactive
@nathaliellenaa nathaliellenaa had a problem deploying to ml-commons-cicd-env-require-approval March 17, 2025 19:50 — with GitHub Actions Error
@nathaliellenaa nathaliellenaa had a problem deploying to ml-commons-cicd-env-require-approval March 17, 2025 19:50 — with GitHub Actions Failure
Copy link
Collaborator

@mingshl mingshl left a comment

Choose a reason for hiding this comment

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

Thanks @nathaliellenaa for picking this up. LGTM, let's see if the integ pass and verify this fix.

after this PR is merged, you can rebase your the other branch and push again, it should unblock your another PR

@@ -78,7 +78,9 @@ public void test_cohereInference_withDifferent_postProcessFunction() {
List output = (List) inferenceResult.get("inference_results");
assertEquals(errorMsg, 1, output.size());
assertTrue(errorMsg, output.get(0) instanceof Map);
validateOutput(errorMsg, (Map) output.get(0), DATA_TYPE.get(postProcessFunction));
if (output != null && DATA_TYPE != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

DATA_TYPE is a static variable which already have values in it. So checking null for DATA_TYPE isn't adding any value because it will not be null.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, I'll remove the null check for DATA_TYPE.

@nathaliellenaa nathaliellenaa had a problem deploying to ml-commons-cicd-env-require-approval March 17, 2025 20:53 — with GitHub Actions Failure
@nathaliellenaa nathaliellenaa had a problem deploying to ml-commons-cicd-env-require-approval March 17, 2025 20:53 — with GitHub Actions Failure
@nathaliellenaa nathaliellenaa had a problem deploying to ml-commons-cicd-env-require-approval March 17, 2025 21:11 — with GitHub Actions Error
@nathaliellenaa nathaliellenaa had a problem deploying to ml-commons-cicd-env-require-approval March 17, 2025 21:11 — with GitHub Actions Failure
@nathaliellenaa nathaliellenaa had a problem deploying to ml-commons-cicd-env-require-approval March 17, 2025 21:11 — with GitHub Actions Failure
@nathaliellenaa nathaliellenaa had a problem deploying to ml-commons-cicd-env-require-approval March 17, 2025 21:11 — with GitHub Actions Failure
Signed-off-by: Nathalie Jonathan <[email protected]>
@nathaliellenaa nathaliellenaa temporarily deployed to ml-commons-cicd-env-require-approval March 17, 2025 22:23 — with GitHub Actions Inactive
@nathaliellenaa nathaliellenaa temporarily deployed to ml-commons-cicd-env-require-approval March 17, 2025 22:23 — with GitHub Actions Inactive
@nathaliellenaa nathaliellenaa temporarily deployed to ml-commons-cicd-env-require-approval March 17, 2025 22:23 — with GitHub Actions Inactive
@nathaliellenaa nathaliellenaa temporarily deployed to ml-commons-cicd-env-require-approval March 17, 2025 22:23 — with GitHub Actions Inactive
@nathaliellenaa nathaliellenaa had a problem deploying to ml-commons-cicd-env-require-approval March 17, 2025 23:46 — with GitHub Actions Error
@nathaliellenaa nathaliellenaa had a problem deploying to ml-commons-cicd-env-require-approval March 17, 2025 23:46 — with GitHub Actions Failure
@@ -78,7 +78,9 @@ public void test_cohereInference_withDifferent_postProcessFunction() {
List output = (List) inferenceResult.get("inference_results");
assertEquals(errorMsg, 1, output.size());
assertTrue(errorMsg, output.get(0) instanceof Map);
validateOutput(errorMsg, (Map) output.get(0), DATA_TYPE.get(postProcessFunction));
if (output != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Here adding null check for output won't make any difference. If output is null, it would have thrown NullPointerException at line number 79 - output.size().

Here actual issue is in line number 91, outputList.get(0)).get("data_type"). This is becoming null.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we need this PR as the failure IT should already fixed, please check this comment: #3628 (comment)

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.

5 participants