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 FileAccessTreeTests#testDuplicateExclusivePaths to work on windows #124430

Merged

Conversation

ldematte
Copy link
Contributor

@ldematte ldematte commented Mar 8, 2025

Fix PolicyManagerTests#testFilesEntitlementsWithExclusive

Fixes #124437

@ldematte ldematte added >test Issues or PRs that are addressing/adding tests auto-backport Automatically create backport pull requests when merged v8.18.1 v8.19.0 v9.0.1 v9.1.0 :Core/Infra/Entitlements Entitlements infrastructure labels Mar 8, 2025
@ldematte ldematte requested a review from a team as a code owner March 8, 2025 21:56
@elasticsearchmachine
Copy link
Collaborator

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

@prdoyle
Copy link
Contributor

prdoyle commented Mar 10, 2025

This change seems super subtle. I can't see a difference in the behaviour; how does this fix the tests?

@@ -447,7 +447,9 @@ public void testDuplicateEntitlements() {
public void testFilesEntitlementsWithExclusive() {
var baseTestPath = Path.of("/base").toAbsolutePath();
var testPath1 = Path.of("/base/test").toAbsolutePath();
var testPath1String = testPath1.toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought these toString calls are not needed if the Strings.format call is using %s?

@ldematte
Copy link
Contributor Author

This change seems super subtle. I can't see a difference in the behaviour; how does this fix the tests?

By forcing the same string

Failure was:

expected "Path [/a/b] ..." found "Path [C:\a\b] ... " on windows.

@ldematte
Copy link
Contributor Author

Actually you are right, the second one is a red herring, it was not the same issue and it's fixed by Ryan's PR. I'll remove it.

);
var iae = expectThrows(IllegalArgumentException.class, () -> buildExclusivePathList(distinctEntitlements, TEST_PATH_LOOKUP));
var pathABString = pathAB.toAbsolutePath().toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh the fix is this toAbsolutePath() call?

….com:ldematte/elasticsearch into entitlements/fix-testDuplicateExclusivePaths
@ldematte ldematte enabled auto-merge (squash) March 10, 2025 14:21
@ldematte ldematte merged commit 958352f into elastic:main Mar 10, 2025
17 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.18 Commit could not be cherrypicked due to conflicts
8.x Commit could not be cherrypicked due to conflicts
9.0 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 124430

@ldematte
Copy link
Contributor Author

Backports need #123676

georgewallace pushed a commit to georgewallace/elasticsearch that referenced this pull request Mar 11, 2025
ldematte added a commit to ldematte/elasticsearch that referenced this pull request Mar 11, 2025
@ldematte ldematte deleted the entitlements/fix-testDuplicateExclusivePaths branch March 12, 2025 07:41
ldematte added a commit to ldematte/elasticsearch that referenced this pull request Mar 13, 2025
ldematte added a commit to ldematte/elasticsearch that referenced this pull request Mar 13, 2025
jfreden pushed a commit to jfreden/elasticsearch that referenced this pull request Mar 13, 2025
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.18.1 v8.19.0 v9.0.1 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] FileAccessTreeTests testDuplicateExclusivePaths failing
3 participants