Skip to content

Conversation

@DonalEvans
Copy link
Contributor

Closes #134166

@DonalEvans DonalEvans added >test Issues or PRs that are addressing/adding tests :ml Machine learning Team:ML Meta label for the ML team v9.3.0 labels Oct 24, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

Copy link
Contributor

@dimitris-athanasiou dimitris-athanasiou left a comment

Choose a reason for hiding this comment

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

Cool stuff! A couple of comments. Mostly on cleaning up those randomXorNull by reusing existing and adding new ones in ESTestCase. I didn't comment on all the places where that is relevant.

return randomValueOtherThan(instance, AzureOpenAiSecretSettingsTests::createRandom);
SecureString apiKey = instance.apiKey();
SecureString entraId = instance.entraId();
if (apiKey == null || entraId == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

As there is a constructor that accepts the args without doing validation, do we need the complicated logic here?

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'm not seeing a constructor for AzureOpenAiSecretSettings that doesn't do the validation that both arguments aren't null. I could add one, but it doesn't seem like it's worth it just to make one test method slightly simpler.

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right, my eyes ignored Objects.requireNonNullElse(apiKey, entraId);

Copy link
Contributor

@dimitris-athanasiou dimitris-athanasiou left a comment

Choose a reason for hiding this comment

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

LGTM

@DonalEvans DonalEvans merged commit 6c0fd35 into elastic:main Oct 30, 2025
34 checks passed
@DonalEvans DonalEvans deleted the fix-mutate-instance-inference-package branch October 30, 2025 17:23
chrisparrinello pushed a commit to chrisparrinello/elasticsearch that referenced this pull request Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:ml Machine learning Team:ML Meta label for the ML team >test Issues or PRs that are addressing/adding tests v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests misuse randomValueOtherThan() and mutate too many fields at once when testing hashcode and equals methods

3 participants