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

Drop obsolete logic from the downloadFile function in test/downloadutils.js #13420

Merged
merged 1 commit into from
May 22, 2021

Conversation

timvandermeij
Copy link
Contributor

@timvandermeij timvandermeij commented May 22, 2021

This patch is a first step to refactor the testing code to make it more manageable. This is needed in order to, over time, enable the no-var rule there too, which is now made difficult by lots of global variable and callback usage.

This code is old and predates the improvements we made to the test manifest to only contain working URLs (either Web Archive or GitHub/Bugzilla links), so the fallback logic to try the Web Archive is no longer necessary. This greatly simplifies the function and also makes sure that we fail directly in case a bad URL is added to the manifest, instead of having it work "accidentally" because of this logic, since we want the manifest to be correct at all times (and otherwise fail loudly).

To verify that this works I removed my local test/pdfs folder, did a clean checkout of it and ran the tests, which forced a re-download of all files. All files downloaded correctly, there were no MD5 checksum mismatches and the files could also be opened correctly.

…dutils.js`

This code is old and predates the improvements we made to the test
manifest to only contain working URLs (either Web Archive or
GitHub/Bugzilla links), so the fallback logic to try the Web Archive is
no longer necessary. This greatly simplifies the function and also
makes sure that we fail directly in case a bad URL is added to the
manifest, instead of having it work "accidentally" because of this
logic, since we want the manifest to be correct at all times (and
otherwise fail loudly).
@timvandermeij
Copy link
Contributor Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://54.67.70.0:8877/fdd6de0de2181ad/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://3.101.106.178:8877/160c21616820348/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/fdd6de0de2181ad/output.txt

Total script time: 26.18 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED

Image differences available at: http://54.67.70.0:8877/fdd6de0de2181ad/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/160c21616820348/output.txt

Total script time: 29.41 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED

Image differences available at: http://3.101.106.178:8877/160c21616820348/reftest-analyzer.html#web=eq.log

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

This greatly simplifies the function and also makes sure that we fail directly in case a bad URL is added to the manifest,

Failing immediately/explicitly is much nicer indeed, since there's nothing worse than a silent failure when trying to debug something!

instead of having it work "accidentally" because of this logic, since we want the manifest to be correct at all times (and otherwise fail loudly).

Honestly, the fallback logic was probably never all that helpful to begin with, since it's likely that the md5-hashes didn't match and in that case you might not even test the intended thing anyway.


Looks good to me, whatever can be done to modernize/improve the test-code is a welcome change; thank you!

@timvandermeij timvandermeij merged commit 9127e11 into mozilla:master May 22, 2021
@timvandermeij timvandermeij deleted the test-downloadutils branch May 22, 2021 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants