From 85d187133ddcea5284529bc57caaa7f66f73ab95 Mon Sep 17 00:00:00 2001 From: Justin Wernick Date: Sat, 11 Mar 2023 22:33:28 +0200 Subject: Fix docker shell issue --- tests/server_shell.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/server_shell.rs b/tests/server_shell.rs index 323fe5f..3813013 100644 --- a/tests/server_shell.rs +++ b/tests/server_shell.rs @@ -1,6 +1,6 @@ use anyhow::Result; use assert_cmd::{cargo::cargo_bin, Command}; -use get_port::{tcp::TcpPort, Ops}; +use get_port::{tcp::TcpPort, Ops, Range}; use rexpect::session::{spawn_command, PtySession}; use std::{io, path, sync::Once}; use tempfile::TempDir; @@ -45,7 +45,6 @@ fn build_docker_image() -> Result<(), DockerBuildError> { let relative_shell_path = absolute_shell_path.strip_prefix(std::fs::canonicalize(".")?)?; command.args([ "build", - "--quiet", "-t", "shackle-server", "--build-arg", @@ -76,7 +75,15 @@ fn spawn_ssh_server() -> Result { let workdir = tempfile::tempdir()?; - let ssh_port = TcpPort::any("127.0.0.1").unwrap(); + // TODO: Put the used ports in an Arc + let ssh_port = TcpPort::in_range( + "127.0.0.1", + Range { + min: 2022, + max: 3022, + }, + ) + .unwrap(); let mut command = std::process::Command::new("docker"); command.args([ @@ -139,9 +146,14 @@ fn git_clone_works_with_an_empty_repo() -> Result<()> { make_new_repo(&c, repo_name)?; Command::new("git") - .arg("clone") - .arg(&format!("shukkie@localhost:2022:{}.git", repo_name)) + .args([ + "clone", + "-v", + "--progress", + &format!("ssh://shukkie@localhost:{}/{}.git", c.ssh_port, repo_name), + ]) .current_dir(&c.workdir) + .timeout(std::time::Duration::from_secs(3)) .assert() .success(); -- cgit v1.2.3