summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2023-03-11 22:33:28 +0200
committerJustin Wernick <justin@worthe-it.co.za>2023-03-11 22:33:28 +0200
commit85d187133ddcea5284529bc57caaa7f66f73ab95 (patch)
tree62852b8bda4b2982ec240eb762eaa2c4892859c3 /tests
parent5b52ed7ed242ce40cfd331a2fdb78e106413e138 (diff)
Fix docker shell issue
Diffstat (limited to 'tests')
-rw-r--r--tests/server_shell.rs22
1 files changed, 17 insertions, 5 deletions
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<TestContext> {
let workdir = tempfile::tempdir()?;
- let ssh_port = TcpPort::any("127.0.0.1").unwrap();
+ // TODO: Put the used ports in an Arc<BTreeSet>
+ 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();