mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-04-18 09:03:12 +00:00
Make local nodes log to NOMOS_LOG_DIR and allow slower startup
This commit is contained in:
parent
933d238eeb
commit
33ed2b7a1c
@ -37,6 +37,12 @@ fn binary_path() -> PathBuf {
|
|||||||
if let Some(path) = which_on_path("nomos-executor") {
|
if let Some(path) = which_on_path("nomos-executor") {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
// Default to the shared bin staging area; fall back to workspace target.
|
||||||
|
let shared_bin = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||||
|
.join("../../testing-framework/assets/stack/bin/nomos-executor");
|
||||||
|
if shared_bin.exists() {
|
||||||
|
return shared_bin;
|
||||||
|
}
|
||||||
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||||
.join("../../")
|
.join("../../")
|
||||||
.join(BIN_PATH)
|
.join(BIN_PATH)
|
||||||
@ -141,11 +147,21 @@ impl Executor {
|
|||||||
let file = std::fs::File::create(&config_path).unwrap();
|
let file = std::fs::File::create(&config_path).unwrap();
|
||||||
|
|
||||||
if !*IS_DEBUG_TRACING {
|
if !*IS_DEBUG_TRACING {
|
||||||
// setup logging so that we can intercept it later in testing
|
if let Ok(env_dir) = std::env::var("NOMOS_LOG_DIR") {
|
||||||
config.tracing.logger = LoggerLayer::File(FileConfig {
|
let log_dir = PathBuf::from(env_dir);
|
||||||
directory: dir.path().to_owned(),
|
let _ = std::fs::create_dir_all(&log_dir);
|
||||||
prefix: Some(LOGS_PREFIX.into()),
|
config.tracing.logger = LoggerLayer::File(FileConfig {
|
||||||
});
|
directory: log_dir,
|
||||||
|
prefix: Some(LOGS_PREFIX.into()),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// If no explicit log dir is provided, fall back to a tempdir so we can capture
|
||||||
|
// logs.
|
||||||
|
config.tracing.logger = LoggerLayer::File(FileConfig {
|
||||||
|
directory: dir.path().to_owned(),
|
||||||
|
prefix: Some(LOGS_PREFIX.into()),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config.storage.db_path = dir.path().join("db");
|
config.storage.db_path = dir.path().join("db");
|
||||||
@ -174,7 +190,7 @@ impl Executor {
|
|||||||
config,
|
config,
|
||||||
api: ApiClient::new(addr, Some(testing_addr)),
|
api: ApiClient::new(addr, Some(testing_addr)),
|
||||||
};
|
};
|
||||||
tokio::time::timeout(adjust_timeout(Duration::from_secs(10)), async {
|
tokio::time::timeout(adjust_timeout(Duration::from_secs(30)), async {
|
||||||
node.wait_online().await;
|
node.wait_online().await;
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
|
|||||||
@ -36,6 +36,12 @@ fn binary_path() -> PathBuf {
|
|||||||
if let Some(path) = which_on_path("nomos-node") {
|
if let Some(path) = which_on_path("nomos-node") {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
// Default to the shared bin staging area; fall back to workspace target.
|
||||||
|
let shared_bin = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||||
|
.join("../../testing-framework/assets/stack/bin/nomos-node");
|
||||||
|
if shared_bin.exists() {
|
||||||
|
return shared_bin;
|
||||||
|
}
|
||||||
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||||
.join("../../")
|
.join("../../")
|
||||||
.join(BIN_PATH)
|
.join(BIN_PATH)
|
||||||
@ -168,11 +174,21 @@ impl Validator {
|
|||||||
let file = std::fs::File::create(&config_path).unwrap();
|
let file = std::fs::File::create(&config_path).unwrap();
|
||||||
|
|
||||||
if !*IS_DEBUG_TRACING {
|
if !*IS_DEBUG_TRACING {
|
||||||
// setup logging so that we can intercept it later in testing
|
if let Ok(env_dir) = std::env::var("NOMOS_LOG_DIR") {
|
||||||
config.tracing.logger = LoggerLayer::File(FileConfig {
|
let log_dir = PathBuf::from(env_dir);
|
||||||
directory: dir.path().to_owned(),
|
let _ = std::fs::create_dir_all(&log_dir);
|
||||||
prefix: Some(LOGS_PREFIX.into()),
|
config.tracing.logger = LoggerLayer::File(FileConfig {
|
||||||
});
|
directory: log_dir,
|
||||||
|
prefix: Some(LOGS_PREFIX.into()),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// If no explicit log dir is provided, fall back to a tempdir so we can capture
|
||||||
|
// logs.
|
||||||
|
config.tracing.logger = LoggerLayer::File(FileConfig {
|
||||||
|
directory: dir.path().to_owned(),
|
||||||
|
prefix: Some(LOGS_PREFIX.into()),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config.storage.db_path = dir.path().join("db");
|
config.storage.db_path = dir.path().join("db");
|
||||||
@ -203,7 +219,7 @@ impl Validator {
|
|||||||
api: ApiClient::new(addr, Some(testing_addr)),
|
api: ApiClient::new(addr, Some(testing_addr)),
|
||||||
};
|
};
|
||||||
|
|
||||||
tokio::time::timeout(adjust_timeout(Duration::from_secs(10)), async {
|
tokio::time::timeout(adjust_timeout(Duration::from_secs(30)), async {
|
||||||
node.wait_online().await;
|
node.wait_online().await;
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user