Skip to content

MockMaker support, tests for KNNVectorValuesTests, KNNVectorValuesFactoryTests#421

Draft
WojciechKrakowiak wants to merge 2 commits intoopensearch-project:mainfrom
WojciechKrakowiak:wk-419-1
Draft

MockMaker support, tests for KNNVectorValuesTests, KNNVectorValuesFactoryTests#421
WojciechKrakowiak wants to merge 2 commits intoopensearch-project:mainfrom
WojciechKrakowiak:wk-419-1

Conversation

@WojciechKrakowiak
Copy link
Copy Markdown
Contributor

@WojciechKrakowiak WojciechKrakowiak commented Apr 17, 2026

Description

Part one of tests implementation for #419

KNNVectorValuesTests.java – newest version was compatible

TestVectorValues.java
Compatible version doesn’t include changes from this PR: opensearch-project/k-NN#2587

KNNVectorValuesFactoryTests.java
Migrated state: opensearch-project/k-NN@a4697f4

Mocking final classes requires inline-mock-maker. In solution from KNN, mockito was self-attaching to enable the inline-mock-maker, resulting in deprecation warning. I followed the instructions how to add mockito as an agend to the build, which solves the issue and don’t require additional byte-buddy dependencies. (https://javadoc.io/doc/org.mockito/mockito-core/latest/org.mockito/org/mockito/Mockito.html#0.3)

Original KNN solution: https://github.com/opensearch-project/k-NN/pull/759/changes#diff-49a96e7eea8a94af862798a45174e6ac43eb4f8b4bd40759b5da63ba31ec3ef7
Warning from original solution:

Mockito is currently self-attaching to enable the inline-mock-maker. This will no longer work in future releases of the JDK. Please add Mockito as an agent to your build as described in Mockito's documentation: https://javadoc.io/doc/org.mockito/mockito-core/latest/org.mockito/org/mockito/Mockito.html#0.3
WARNING: A Java agent has been loaded dynamically (/Users/wojciechkrakowiak/.gradle/caches/modules-2/files-2.1/net.bytebuddy/byte-buddy-agent/1.18.8/ed5c6c9b3a146b4aa376df3b6770d6cabed20482/byte-buddy-agent-1.18.8.jar)
WARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning
WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information
WARNING: Dynamic loading of agents will be disallowed by default in a future release

Related Issues

Part of #419

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.

…toryTests

Signed-off-by: Wojciech Krakowiak <wojciech.krakowiak@ibm.com>
Signed-off-by: Wojciech Krakowiak <wojciech.krakowiak@ibm.com>
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.

1 participant