summaryrefslogtreecommitdiff
path: root/test_util/src
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2021-06-08 17:56:54 -0400
committerGitHub <noreply@github.com>2021-06-08 17:56:54 -0400
commit50063749e2b52098136df47dd22f7edd2b26ee5b (patch)
treed8d7269c6c3b97cf0f531fd2e4885677a1979f86 /test_util/src
parentb98293e21cb7e55def8fea2ca015381150d4cebf (diff)
chore(tests): Friendlier message when running the tests and forgetting to run `cargo build` first. (#10901)
Diffstat (limited to 'test_util/src')
-rw-r--r--test_util/src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs
index 4cfc5cc9c..db0114b8c 100644
--- a/test_util/src/lib.rs
+++ b/test_util/src/lib.rs
@@ -132,6 +132,15 @@ pub fn test_server_path() -> PathBuf {
p
}
+fn ensure_test_server_built() {
+ // if the test server doesn't exist then remind the developer to build first
+ if !test_server_path().exists() {
+ panic!(
+ "Test server not found. Please cargo build before running the tests."
+ );
+ }
+}
+
/// Benchmark server that just serves "hello world" responses.
async fn hyper_hello(port: u16) {
println!("hyper hello");
@@ -1043,6 +1052,7 @@ impl Drop for HttpServerGuard {
/// last instance of the HttpServerGuard is dropped, the subprocess will be
/// killed.
pub fn http_server() -> HttpServerGuard {
+ ensure_test_server_built();
let mut g = lock_http_server();
g.inc();
HttpServerGuard {}