From d7bb3d14df48e61f0583f672504c38bb293d512c Mon Sep 17 00:00:00 2001 From: Bojan Serafimov Date: Mon, 30 May 2022 15:39:08 -0400 Subject: [PATCH] WIP --- .circleci/config.yml | 3 ++- pageserver/src/bin/pageserver.rs | 18 +++++++++++++++++- test_runner/batch_others/test_ci.py | 11 +++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 test_runner/batch_others/test_ci.py diff --git a/.circleci/config.yml b/.circleci/config.yml index 5346e35c01..233157d052 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -293,7 +293,7 @@ jobs: # `Too long with no output` error, if a test is running for a long time. # In that case, tests should have internal timeouts that are less than # no_output_timeout, specified here. - no_output_timeout: 10m + no_output_timeout: 1m environment: - ZENITH_BIN: /tmp/zenith/bin - POSTGRES_DISTRIB_DIR: /tmp/zenith/pg_install @@ -354,6 +354,7 @@ jobs: fi fi - run: + # TODO wait for processes to die in case of timeout? # CircleCI artifacts are preserved one file at a time, so skipping # this step isn't a good idea. If you want to extract the # pageserver state, perhaps a tarball would be a better idea. diff --git a/pageserver/src/bin/pageserver.rs b/pageserver/src/bin/pageserver.rs index ac90500b97..8b88565a63 100644 --- a/pageserver/src/bin/pageserver.rs +++ b/pageserver/src/bin/pageserver.rs @@ -1,6 +1,6 @@ //! Main entry point for the Page Server executable. -use std::{env, path::Path, str::FromStr}; +use std::{env, fs::File, path::Path, process, str::FromStr, thread::sleep, time::Duration}; use tracing::*; use anyhow::{bail, Context, Result}; @@ -276,6 +276,22 @@ fn start_pageserver(conf: &'static PageServerConf, daemonize: bool) -> Result<() let remote_index = tenant_mgr::init_tenant_mgr(conf)?; + // Create file and frequently check if it's still here + thread_mgr::spawn( + ThreadKind::HttpEndpointListener, + None, + None, + "http_endpoint_thread", + true, + move || { + File::create("delete-me.txt").expect("FFFF failed creating file"); + loop { + File::open("delete-me.txt").expect("FFFF cannot find file"); + sleep(Duration::from_millis(10)); + } + }, + )?; + // Spawn a new thread for the http endpoint // bind before launching separate thread so the error reported before startup exits let auth_cloned = auth.clone(); diff --git a/test_runner/batch_others/test_ci.py b/test_runner/batch_others/test_ci.py new file mode 100644 index 0000000000..e936ad076b --- /dev/null +++ b/test_runner/batch_others/test_ci.py @@ -0,0 +1,11 @@ +import pytest +import os +import time + +from fixtures.zenith_fixtures import ZenithEnvBuilder + +def test_timeout(zenith_env_builder: ZenithEnvBuilder, test_output_dir: str): + env = zenith_env_builder.init_start() + + # Sleep long enough with no output so CI step times out + time.sleep(1000)