Usecase:
When user runs gradle azkabanUpload command, there are two scenarios that can happen in terms of login:
Session already exists: In this case user is required to press enter to resume previous session.
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.
Usecase: When user runs
gradle azkabanUpload
command, there are two scenarios that can happen in terms of login: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:
retryIfEmpty
for functionconsoleSecretInput
ofcom.linkedin.gradle.azkaban.AzkabanHelperTest
class, which is responsible for reading password input.false
, to keep previous behavior ifretryIfEmpty
not specified.Testing:
mock-maker-inline
extension enabled. This extenstion is required because we need to mockConsole
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.gradle azkabanUpload
command.