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: More reliable (and correct) download #17

Merged
merged 1 commit into from
Feb 8, 2016
Merged

Conversation

jkrems
Copy link
Contributor

@jkrems jkrems commented Feb 3, 2016

  • The chrome version info may contain a trailing new line.
    This broke our url generation.
  • The broken chrome url lead to the process crashing which lead to
    a broken tmp file. And once that tmp file existed, it was blindly
    copied. We're now waiting for the download to complete and then
    copy the file to a new name once it was actually validated.
    There's still a small window where we may end up in a broken
    state but it's progress.

@@ -63,6 +63,8 @@ module.exports = (callback) ->
version = FALLBACK_CHROMEDRIVER_VERSION
console.log "[testium] Unable to determine latest version of selenium chromedriver; using #{version}"
console.error (error.stack || error)
else
version = "#{version}".trim()
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is version here? Can we do version.trim() or version.toString().trim() instead? Those are more clear to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think version.trim() should be fine. This is just me being uber-careful about calling string methods "just in case" (e.g. null.toString().trim() would throw). Don't think it's warranted here.

* The chrome version info may contain a trailing new line.
  This broke our url generation.
* The broken chrome url lead to the process crashing which lead to
  a broken tmp file. And once that tmp file existed, it was blindly
  copied. We're now waiting for the download to complete and then
  copy the file to a new name once it was actually validated.
  There's still a small window where we may end up in a broken
  state but it's progress.
@jkrems
Copy link
Contributor Author

jkrems commented Feb 3, 2016

Actually, I reverted most of the selenium code changes. Pulling out the method didn't provide value in the last iteration.

'-jar', BIN_PATH + '/selenium.jar', '-h'
], (error, stdout) ->
throw error if error?
clearFileSystem()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this after error so that you can inspect the file system state in the error case? If so, what about the other error case at https://github.com/groupon/selenium-download/pull/17/files#diff-3679dd81e69928644563abcacc1e00ddR44 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I understand - in the success case it will clear the file system and in the failure case as well. I treated this as "insert an additional assertion about the files" so I inserted the new code between the existing assertions and the cleanup. Do you mean that it should delete the file before throwing the error?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, so it will. Yeah, this is fine.

jkrems added a commit that referenced this pull request Feb 8, 2016
fix: More reliable (and correct) download
@jkrems jkrems merged commit 0fd8dd3 into master Feb 8, 2016
@jkrems jkrems deleted the jk-safer-download branch February 8, 2016 16:55
@jkrems
Copy link
Contributor Author

jkrems commented Feb 8, 2016

@EndangeredMassa Looks like I don't have access to this on npm. Could you release this change (and/or add me as an owner :))?

@jkrems
Copy link
Contributor Author

jkrems commented Feb 18, 2016

@EndangeredMassa Ping? :)

@EndangeredMassa
Copy link
Collaborator

Added. Sorry for the delay!

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