Use explicit newline with keystore stdin test (#127094) (#127128)

The add string keystore command accepts input on stdin. In this case,
the terminal is responsible for separating input by newlines that are
system dependent. The mock terminal normally adds the system dependent
newline. However, we also have tests that ensure both unix and windows
style newlines are tested explicitly. This commit fixes the windows
style carriage returns to explicitly contain a newline.

closes #127089
This commit is contained in:
Ryan Ernst 2025-04-21 14:28:18 -07:00 committed by GitHub
parent d3f1b52394
commit e79d033f1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -193,7 +193,7 @@ public class AddStringKeyStoreCommandTests extends KeyStoreCommandTestCase {
String password = "keystorepassword"; String password = "keystorepassword";
KeyStoreWrapper.create().save(env.configDir(), password.toCharArray()); KeyStoreWrapper.create().save(env.configDir(), password.toCharArray());
terminal.addSecretInput(password); terminal.addSecretInput(password);
terminal.addSecretInput("Typedthisandhitenter\r"); terminal.addSecretInput("Typedthisandhitenter\r\n");
execute("-x", "foo"); execute("-x", "foo");
assertSecureString("foo", "Typedthisandhitenter", password); assertSecureString("foo", "Typedthisandhitenter", password);
} }