mirror of
https://github.com/Nutomic/ibis.git
synced 2024-11-22 08:11:08 +00:00
try to reduce test failures
This commit is contained in:
parent
3adcd98b3f
commit
36995bfcc7
3 changed files with 16 additions and 9 deletions
|
@ -19,7 +19,6 @@ BETA_DB_PATH="$DB_FOLDER/beta"
|
|||
|
||||
ALPHA_DB_URL="postgresql://ibis:password@/ibis?host=$ALPHA_DB_PATH"
|
||||
BETA_DB_URL="postgresql://ibis:password@/ibis?host=$BETA_DB_PATH"
|
||||
echo $ALPHA_DB_URL
|
||||
|
||||
# get rid of processes leftover from previous runs
|
||||
killall ibis || true
|
||||
|
@ -31,4 +30,7 @@ CARGO_TARGET_DIR=target/frontend trunk build
|
|||
(trap 'kill 0' SIGINT;
|
||||
sh -c "IBIS__BIND=127.0.0.1:8070 IBIS__FEDERATION__DOMAIN=ibis-alpha:8070 IBIS__DATABASE_URL=$ALPHA_DB_URL cargo run" &
|
||||
sh -c "IBIS__BIND=127.0.0.1:8080 IBIS__FEDERATION__DOMAIN=ibis-beta:8080 IBIS__DATABASE_URL=$BETA_DB_URL cargo run" &
|
||||
)
|
||||
)
|
||||
|
||||
./tests/scripts/stop_dev_db.sh $ALPHA_DB_PATH
|
||||
./tests/scripts/stop_dev_db.sh $BETA_DB_PATH
|
|
@ -5,7 +5,7 @@ use ibis_lib::frontend::api::ApiClient;
|
|||
use ibis_lib::frontend::error::MyResult;
|
||||
use reqwest::ClientBuilder;
|
||||
use std::env::current_dir;
|
||||
use std::fs::create_dir_all;
|
||||
use std::fs::{create_dir_all, remove_dir_all};
|
||||
use std::ops::Deref;
|
||||
use std::process::{Command, Stdio};
|
||||
use std::sync::atomic::{AtomicI32, Ordering};
|
||||
|
@ -90,11 +90,15 @@ pub struct IbisInstance {
|
|||
|
||||
impl IbisInstance {
|
||||
fn prepare_db(db_path: String) -> std::thread::JoinHandle<()> {
|
||||
// stop any db leftover from previous run
|
||||
Self::stop_internal(db_path.clone());
|
||||
// remove old db
|
||||
remove_dir_all(&db_path).unwrap();
|
||||
spawn(move || {
|
||||
Command::new("./tests/scripts/start_dev_db.sh")
|
||||
.arg(&db_path)
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::null())
|
||||
.stdout(Stdio::inherit())
|
||||
.stderr(Stdio::inherit())
|
||||
.output()
|
||||
.unwrap();
|
||||
})
|
||||
|
@ -135,9 +139,13 @@ impl IbisInstance {
|
|||
|
||||
fn stop(self) -> std::thread::JoinHandle<()> {
|
||||
self.db_handle.abort();
|
||||
Self::stop_internal(self.db_path)
|
||||
}
|
||||
|
||||
fn stop_internal(db_path: String) -> std::thread::JoinHandle<()> {
|
||||
spawn(move || {
|
||||
Command::new("./tests/scripts/stop_dev_db.sh")
|
||||
.arg(&self.db_path)
|
||||
.arg(db_path)
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::null())
|
||||
.output()
|
||||
|
|
|
@ -12,9 +12,6 @@ then
|
|||
pg_ctl stop
|
||||
fi
|
||||
|
||||
# Remove any leftover data from revious run
|
||||
rm -rf $1
|
||||
|
||||
# Create cluster
|
||||
initdb --username=postgres --auth=trust --no-instructions
|
||||
|
||||
|
|
Loading…
Reference in a new issue