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

[Misc] Fix repository clone error on NTFS filesystems #3524

Merged
merged 1 commit into from
Sep 30, 2024

Conversation

pjeanjean
Copy link
Contributor

Changes

Description

<strong>EscapedAttachment.txt is no longer stored on the repository. Instead, a file containing the <strong> tag is created during the test that requires it.

Clarifications

This change requires adding to the page object an upload method supporting local files, which is done through Selenium's LocalFileDetector.

Executed Tests

AttachmentIT was run locally with the included changes.

Expected merging strategy

  • Prefers squash: Yes
  • Backport on branches:
    • stable-15.10.x
    • stable-16.4.x

@surli surli added backport stable-15.10.x Used for automatic backport to 15.10.x branch. backport stable-16.4.x labels Sep 30, 2024
@surli surli merged commit e3980b9 into xwiki:master Sep 30, 2024
3 checks passed

// We shouldn't store files with special characters in the repository, since some filesystems don't support it.
// Instead, we create the file during the test.
Path unescapedFile = Files.createTempFile("<strong>", null);
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this going to fail during the test (because it won't be able to create a file named like this) on Windows ?

Copy link
Member

Choose a reason for hiding this comment

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

Not much we can do about that, since this test is specifically about testing this kind of filename no? At least the PR fixes the current situation preventing to perform the clone.

Copy link
Member

Choose a reason for hiding this comment

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

Not much we can do about that, since this test is specifically about testing this kind of filename no?

If the test is only about display, we can simply upload the attachment using something that let us choose the name of the attachment without the need to have an actual file on the filesystem (like REST).

Copy link
Contributor

Choose a reason for hiding this comment

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

This test is about testing the actual JavaScript code for handling the upload. See XWIKI-19611 for context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good question. I would expect the nio.Files API to support such use cases and escape the name on NTFS filesystems, but I can't test it.
Having the name escaped would definitely make the test useless though. Do we support running Docker tests on Windows?

Copy link
Member

Choose a reason for hiding this comment

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

Do we support running Docker tests on Windows?

yes, in theory we should be able to build and test xwiki in any system

Copy link
Member

Choose a reason for hiding this comment

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

This test is about testing the actual JavaScript code for handling the upload.

OK, so that's indeed more complex. Maybe there would be some hack to have the browser end up with a different name than the actual file on filesystem...

Copy link
Member

@vmassol vmassol Sep 30, 2024

Choose a reason for hiding this comment

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

We didn't at the time since TC was not supporting it (it was very experimental), but I haven't retested it, maybe it works now: https://java.testcontainers.org/supported_docker_environment/windows/

Requires a windows machine AFAICS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport stable-15.10.x Used for automatic backport to 15.10.x branch. backport stable-16.4.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants