Skip to content

Ensure supported locale outside of Entitlements check#143405

Merged
mamazzol merged 4 commits intoelastic:mainfrom
mamazzol:ci-143323
Mar 3, 2026
Merged

Ensure supported locale outside of Entitlements check#143405
mamazzol merged 4 commits intoelastic:mainfrom
mamazzol:ci-143323

Conversation

@mamazzol
Copy link
Copy Markdown
Contributor

@mamazzol mamazzol commented Mar 2, 2026

Locale.setDefault(Locale.ENGLISH) can be called from inside ESTestCase.ensureSupportedLocale().
In tests that:

  • Enable entitlements
  • Run in FIPS mode
  • Use one of the unusable locales

The code wants to set the locale to English and runs into an entitlement exception
As this is a need for the test, we call ESTestCase.ensureSupportedLocale() a bit early in the stack when the entitlements for test code are not yet enforced.

Closes: #143323

@mamazzol mamazzol added >test Issues or PRs that are addressing/adding tests auto-backport Automatically create backport pull requests when merged Team:Core/Infra Meta label for core/infra team labels Mar 2, 2026
@elasticsearchmachine elasticsearchmachine added v9.4.0 needs:triage Requires assignment of a team area label and removed Team:Core/Infra Meta label for core/infra team labels Mar 2, 2026
@mamazzol mamazzol added the Team:Core/Infra Meta label for core/infra team label Mar 2, 2026
@mamazzol mamazzol requested a review from a team March 2, 2026 16:42
@elasticsearchmachine elasticsearchmachine removed the Team:Core/Infra Meta label for core/infra team label Mar 2, 2026
@mamazzol mamazzol added Team:Core/Infra Meta label for core/infra team :Core/Infra/Entitlements Entitlements infrastructure labels Mar 2, 2026
@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Mar 2, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

Copy link
Copy Markdown
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

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

Seems fine to me. Are we certain that the TestEntitlementRule will always run after whatever sets the random locale?

@mamazzol
Copy link
Copy Markdown
Contributor Author

mamazzol commented Mar 2, 2026

ESTestCase has ensureSupportedLocale as @BeforeClass so it will be run on every test. If the test happens to hit the necessary combination then it will fail.

@mamazzol mamazzol changed the title Ci 143323 Ensure supported locale outside of Entitlements check Mar 2, 2026
@mark-vieira
Copy link
Copy Markdown
Contributor

ESTestCase has ensureSupportedLocale as @BeforeClass so it will be run on every test. If the test happens to hit the necessary combination then it will fail.

Right, my point being that the randomly chosen locale needs to have already been set. I'm not even certain where that happens.

@mamazzol
Copy link
Copy Markdown
Contributor Author

mamazzol commented Mar 2, 2026

Right, my point being that the randomly chosen locale needs to have already been set. I'm not even certain where that happens.

My understanding is that it's randomly set by LuceneTestCase which is the parent class of ESTestCase. The order should be guaranteed by the hierarchy.

@mamazzol mamazzol merged commit ed27c61 into elastic:main Mar 3, 2026
35 checks passed
mamazzol added a commit to mamazzol/elasticsearch that referenced this pull request Mar 3, 2026
* Ensure supported locale in test around entitlements
mamazzol added a commit to mamazzol/elasticsearch that referenced this pull request Mar 3, 2026
* Ensure supported locale in test around entitlements
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

💚 Backport successful

Status Branch Result
9.3
8.19
9.2

mamazzol added a commit to mamazzol/elasticsearch that referenced this pull request Mar 3, 2026
* Ensure supported locale in test around entitlements
elasticsearchmachine pushed a commit that referenced this pull request Mar 3, 2026
)

* Ensure supported locale in test around entitlements
elasticsearchmachine pushed a commit that referenced this pull request Mar 3, 2026
)

* Ensure supported locale in test around entitlements
elasticsearchmachine pushed a commit that referenced this pull request Mar 3, 2026
)

* Ensure supported locale in test around entitlements
@mamazzol mamazzol deleted the ci-143323 branch March 3, 2026 14:07
szybia added a commit to szybia/elasticsearch that referenced this pull request Mar 3, 2026
…cations

* upstream/main: (56 commits)
  Mute org.elasticsearch.compute.lucene.read.ValueSourceReaderTypeConversionTests testLoadAll elastic#143471
  [DOCS] Fix ES|QL function and commands lists versioning metadata (elastic#143402)
  Fix MMROperatorTests (elastic#143453)
  Fix CSV-escaped quotes in generated docs examples (elastic#143449)
  Fix SQL client parsing of array header values (elastic#143408)
  ESQL: Add extended distribution tests and fault injection for external sources (elastic#143420)
  ESQL: Fix datasource test failures on Windows and FIPS (elastic#143417)
  Add circuit breaker for query construction to prevent OOM from automaton-based queries (elastic#142150)
  Cleanup SpecIT logging configuration (elastic#143365)
  ESQL: Prune unused regex extract nodes in optimizer (elastic#140982)
  Ensure supported locale outside of Entitlements check (elastic#143405)
  feat(es|ql): add dense_vector support in coalesce (elastic#142974)
  [Test] Unmute SnapshotStressTestsIT (elastic#143359)
  Mute org.elasticsearch.xpack.esql.CsvIT test {csv-spec:lookup-join.LookupJoinWithCoalesceFilterOnRight} elastic#143443
  Mute org.elasticsearch.xpack.esql.CsvIT test {csv-spec:lookup-join.MvJoinKeyOnTheLookupIndex} elastic#143442
  ESQL: Fix CCS exchange sink cleanup (elastic#143325)
  Mute org.elasticsearch.xpack.esql.CsvIT test {csv-spec:lookup-join.MvJoinKeyOnTheLookupIndexAfterStats} elastic#143434
  Mute org.elasticsearch.xpack.esql.CsvIT test {csv-spec:lookup-join.MvJoinKeyFromRow} elastic#143432
  Mute org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT test {csv-spec:k8s-timeseries.Datenanos_derivative_compared_to_rate} elastic#143431
  Mute org.elasticsearch.multiproject.test.CoreWithMultipleProjectsClientYamlTestSuiteIT test {yaml=search.retrievers/result-diversification/10_mmr_result_diversification_retriever/Test MMR result diversification single index float type} elastic#143430
  ...
tballison pushed a commit to tballison/elasticsearch that referenced this pull request Mar 3, 2026
* Ensure supported locale in test around entitlements
shmuelhanoch pushed a commit to shmuelhanoch/elasticsearch that referenced this pull request Mar 4, 2026
* Ensure supported locale in test around entitlements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged :Core/Infra/Entitlements Entitlements infrastructure Team:Core/Infra Meta label for core/infra team >test Issues or PRs that are addressing/adding tests v8.19.13 v9.2.7 v9.3.2 v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] WithEntitlementsOnTestCodeMetaTests class failing

3 participants