Skip to content

Compare thumbnail files instead of stringifying them #2555

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

Merged
merged 4 commits into from
Jul 11, 2025

Conversation

labkey-tchad
Copy link
Member

Rationale

LevenshteinDistance was used for verifying thumbnail files because WebTestHelper.getHttpResponse subtly modifies the response.
We can compare the thumbnail precisely if we look at the actual bytes. AssertJ actually has a method for this, making TestFileUtils.getMD5Hash obsolete in record time.

java.lang.RuntimeException: java.nio.charset.MalformedInputException: Input length = 1
  at org.labkey.test.TestFileUtils.getFileContents(TestFileUtils.java:121)
  at org.labkey.test.TestFileUtils.getFileContents(TestFileUtils.java:107)
  at org.labkey.test.tests.SimpleModuleTest.verifyReportThumbnail(SimpleModuleTest.java:1228)
  at org.labkey.test.tests.SimpleModuleTest.doTestReportThumbnails(SimpleModuleTest.java:1184)
  at org.labkey.test.tests.SimpleModuleTest.doTestReports(SimpleModuleTest.java:1174)
  at org.labkey.test.tests.SimpleModuleTest.doVerifySteps(SimpleModuleTest.java:274)
  at org.labkey.test.tests.SimpleModuleTest.testSteps(SimpleModuleTest.java:259)

Related Pull Requests

Changes

  • Compare thumbnail files instead of stringifying them

WebTestHelper.getHttpResponse subtly modifies the response
LevenshteinDistance comparison is unnecessary when comparing actual bytes
@labkey-tchad labkey-tchad requested review from a team and labkey-danield and removed request for a team July 11, 2025 18:55
@labkey-tchad labkey-tchad merged commit d2939f9 into release25.7-SNAPSHOT Jul 11, 2025
7 checks passed
@labkey-tchad labkey-tchad deleted the 25.7_fb_compareThumbnailFiles branch July 11, 2025 20:30
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.

2 participants