From b0caae5c294731eaf5f883b44d997e43c49cc790 Mon Sep 17 00:00:00 2001 From: ghpzin Date: Mon, 9 Sep 2024 13:00:10 +0300 Subject: [PATCH] nixos/tests/gnupg: fix prompt handling - change send_chars and wait_until_tty_matches to handle new password prompt in one TUI. Switching with tab between enter and re-enter of password --- nixos/tests/gnupg.nix | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/nixos/tests/gnupg.nix b/nixos/tests/gnupg.nix index 65a9a93007fd..68110c9d6d54 100644 --- a/nixos/tests/gnupg.nix +++ b/nixos/tests/gnupg.nix @@ -69,9 +69,11 @@ import ./make-test-python.nix ({ pkgs, lib, ...}: machine.wait_until_tty_matches("1", "Change") machine.send_chars("O\n") machine.wait_until_tty_matches("1", "Please enter") - machine.send_chars("pgp_p4ssphrase\n") - machine.wait_until_tty_matches("1", "Please re-enter") - machine.send_chars("pgp_p4ssphrase\n") + machine.send_chars("pgp_p4ssphrase") + machine.send_key("tab") + machine.send_chars("pgp_p4ssphrase") + machine.wait_until_tty_matches("1", "Passphrases match") + machine.send_chars("\n") machine.wait_until_tty_matches("1", "public and secret key created") with subtest("Confirm the key is in the keyring"): @@ -90,9 +92,11 @@ import ./make-test-python.nix ({ pkgs, lib, ...}: machine.wait_until_tty_matches("1", "Enter passphrase") machine.send_chars("ssh_p4ssphrase\n") machine.wait_until_tty_matches("1", "Please enter") - machine.send_chars("ssh_agent_p4ssphrase\n") - machine.wait_until_tty_matches("1", "Please re-enter") - machine.send_chars("ssh_agent_p4ssphrase\n") + machine.send_chars("ssh_agent_p4ssphrase") + machine.send_key("tab") + machine.send_chars("ssh_agent_p4ssphrase") + machine.wait_until_tty_matches("1", "Passphrases match") + machine.send_chars("\n") with subtest("Confirm the SSH key has been registered"): machine.wait_until_succeeds(as_alice("ssh-add -l | grep -q alice@machine"))