first pass of merging in warp (doesn't build)
This commit is contained in:
@@ -1,24 +1,20 @@
|
||||
use galaxyui::{
|
||||
async_assert, async_assert_eq,
|
||||
integration::{AssertionOutcome, TestStep},
|
||||
};
|
||||
use regex::Regex;
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::{
|
||||
integration_testing::{
|
||||
step::assert_no_pending_model_events,
|
||||
terminal::{
|
||||
assert_long_running_block_executing_for_single_terminal_in_tab,
|
||||
execute_command_for_single_terminal_in_tab, util::ExpectedExitStatus,
|
||||
validate_block_output, wait_until_bootstrapped_pane,
|
||||
},
|
||||
view_getters::{single_terminal_view, terminal_view},
|
||||
},
|
||||
terminal::{model::rich_content::RichContentType, view::WithinBlockBanner},
|
||||
};
|
||||
use regex::Regex;
|
||||
use warpui::integration::{AssertionOutcome, TestStep};
|
||||
use warpui::{async_assert, async_assert_eq};
|
||||
|
||||
use super::util::{ssh_command, user_host};
|
||||
use super::util::{remote_server_ssh_command, remote_server_user_host, ssh_command, user_host};
|
||||
use crate::integration_testing::step::assert_no_pending_model_events;
|
||||
use crate::integration_testing::terminal::util::ExpectedExitStatus;
|
||||
use crate::integration_testing::terminal::{
|
||||
assert_long_running_block_executing_for_single_terminal_in_tab,
|
||||
execute_command_for_single_terminal_in_tab, validate_block_output,
|
||||
wait_until_bootstrapped_pane,
|
||||
};
|
||||
use crate::integration_testing::view_getters::{single_terminal_view, terminal_view};
|
||||
use crate::terminal::model::rich_content::RichContentType;
|
||||
use crate::terminal::view::WithinBlockBanner;
|
||||
|
||||
/// Sets environment variables needed by the Google Cloud SDK.
|
||||
pub fn setup_gcloud_sdk() -> TestStep {
|
||||
@@ -40,6 +36,15 @@ pub fn enter_ssh_command(shell: &str) -> TestStep {
|
||||
.with_keystrokes(&["enter"])
|
||||
.set_post_step_pause(Duration::from_millis(250))
|
||||
}
|
||||
pub fn enter_remote_server_ssh_command(shell: &str) -> TestStep {
|
||||
let ssh_command = remote_server_ssh_command(shell, true);
|
||||
TestStep::new(&format!(
|
||||
"Start remote-server ssh connection with remote shell '{shell}'"
|
||||
))
|
||||
.with_typed_characters(&[&ssh_command])
|
||||
.with_keystrokes(&["enter"])
|
||||
.set_post_step_pause(Duration::from_millis(250))
|
||||
}
|
||||
|
||||
pub fn enter_remote_subshell_command(shell: &str) -> TestStep {
|
||||
let ssh_command = ssh_command(shell, false);
|
||||
@@ -52,6 +57,15 @@ pub fn enter_remote_subshell_command(shell: &str) -> TestStep {
|
||||
/// Waits for a password prompt.
|
||||
pub fn wait_for_password_prompt(tab_index: usize, shell: &str) -> TestStep {
|
||||
let user_host = user_host(shell);
|
||||
wait_for_password_prompt_for_user_host(tab_index, user_host)
|
||||
}
|
||||
|
||||
pub fn wait_for_remote_server_password_prompt(tab_index: usize, shell: &str) -> TestStep {
|
||||
let user_host = remote_server_user_host(shell);
|
||||
wait_for_password_prompt_for_user_host(tab_index, user_host)
|
||||
}
|
||||
|
||||
fn wait_for_password_prompt_for_user_host(tab_index: usize, user_host: String) -> TestStep {
|
||||
let regex = Regex::new(&format!("{user_host}'s password:[\\s]*$"))
|
||||
.expect("regex should not fail to compile");
|
||||
TestStep::new("Wait for password prompt")
|
||||
@@ -141,11 +155,3 @@ pub fn assert_subshell_is_bootstrapped(tab_index: usize, pane_index: usize) -> T
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
pub fn accept_tmux_install() -> TestStep {
|
||||
TestStep::new("Accept tmux install").with_keystrokes(&["enter"])
|
||||
}
|
||||
|
||||
pub fn run_exit_command() -> TestStep {
|
||||
TestStep::new("Run exit command").with_keystrokes(&["e", "x", "i", "t", "enter"])
|
||||
}
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
/// The command used to proxy ssh requests through GCP's Identity-Aware Proxy.
|
||||
const PROXY_COMMAND: &str = "gcloud compute start-iap-tunnel ubuntu-14-04 25784 --listen-on-stdin --project=warp-ssh-integration-testing --zone=us-east4-a";
|
||||
/// The command used to proxy remote-server ssh requests through GCP's Identity-Aware Proxy.
|
||||
const REMOTE_SERVER_PROXY_COMMAND: &str = "gcloud compute start-iap-tunnel ssh-remote-server-testing 22 --listen-on-stdin --project=warp-ssh-integration-testing --zone=us-east4-b";
|
||||
|
||||
/// Produces a user/host pair for testing a given remote shell.
|
||||
pub fn user_host(shell: &str) -> String {
|
||||
format!("{shell}@ubuntu-14-04")
|
||||
}
|
||||
/// Produces a user/host pair for remote-server tests.
|
||||
pub fn remote_server_user_host(shell: &str) -> String {
|
||||
format!("{shell}@ssh-remote-server-testing")
|
||||
}
|
||||
|
||||
/// Produces the full ssh command to run to ssh into a given remote shell.
|
||||
pub fn ssh_command(shell: &str, should_use_ssh_wrapper: bool) -> String {
|
||||
@@ -22,3 +28,22 @@ pub fn ssh_command(shell: &str, should_use_ssh_wrapper: bool) -> String {
|
||||
]
|
||||
.join(" ")
|
||||
}
|
||||
|
||||
/// Produces the full ssh command to connect to the dedicated remote-server test host.
|
||||
pub fn remote_server_ssh_command(shell: &str, should_use_ssh_wrapper: bool) -> String {
|
||||
[
|
||||
if should_use_ssh_wrapper {
|
||||
"ssh"
|
||||
} else {
|
||||
"command ssh"
|
||||
},
|
||||
&remote_server_user_host(shell),
|
||||
"-p 22",
|
||||
&format!("-o ProxyCommand=\"{REMOTE_SERVER_PROXY_COMMAND}\""),
|
||||
"-o PreferredAuthentications=password",
|
||||
"-o PubkeyAuthentication=no",
|
||||
"-o StrictHostKeyChecking=no",
|
||||
"-o UserKnownHostsFile=/dev/null",
|
||||
]
|
||||
.join(" ")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user