Skip to content

repeat console input untill non-empty password for azkabanUpload #269

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bhargav-patel
Copy link

Usecase:
When user runs gradle azkabanUpload command, there are two scenarios that can happen in terms of login:

  1. Session already exists: In this case user is required to press enter to resume previous session.
  2. Session doesn't exists/expired: In this case user is asked for password. But this step doesn't check for empty password.

Since option 1 happens most of the time and command takes some time to run, user tends to press return key one or more time as soon as command is run. But when session is expired, extra return key causes empty password input and gradle task fails. For projects with complex task dependencies it can take up to 5 minutes to reach password prompt again.

Solution:
When password is empty, ask for password again. This way even with extra return keys, user will be still on password prompt.

Changes:

  • Adding optional boolean argument retryIfEmpty for function consoleSecretInput of com.linkedin.gradle.azkaban.AzkabanHelperTest class, which is responsible for reading password input.
  • Setting default value to false, to keep previous behavior if retryIfEmpty not specified.

Testing:

  • Written unittest which succeeds when mock-maker-inline extension enabled. This extenstion is required because we need to mock Console class which is final class(reference). However, adding this extension caused other testcase failures(13 test out of total 49). For now keeping this unit test commented, but I would love to hear comments on this.
  • Tested by running gradle azkabanUpload command.

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.

1 participant