Skip to content

Fix test_cohereInference_withDifferent_postProcessFunction flaky test#3666

Closed
nathaliellenaa wants to merge 2 commits intoopensearch-project:mainfrom
nathaliellenaa:fix-flaky
Closed

Fix test_cohereInference_withDifferent_postProcessFunction flaky test#3666
nathaliellenaa wants to merge 2 commits intoopensearch-project:mainfrom
nathaliellenaa:fix-flaky

Conversation

@nathaliellenaa
Copy link
Copy Markdown
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.

Signed-off-by: Nathalie Jonathan <nathhjo@amazon.com>
@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
Copy Markdown
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

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
Copy Markdown
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
Copy Markdown
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 <nathhjo@amazon.com>
@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
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
Copy Markdown
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
Copy Markdown
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)

@nathaliellenaa nathaliellenaa had a problem deploying to ml-commons-cicd-env-require-approval March 24, 2025 02:47 — with GitHub Actions Failure
@nathaliellenaa nathaliellenaa had a problem deploying to ml-commons-cicd-env-require-approval March 24, 2025 02:47 — with GitHub Actions Error
@nathaliellenaa
Copy link
Copy Markdown
Contributor Author

Closing this PR since the fix is already made in this PR.

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