chore: return Ctx and not ArcCtx
This commit is contained in:
parent
10a5d91bd1
commit
d2801adeca
2 changed files with 10 additions and 5 deletions
|
@ -39,17 +39,17 @@ pub struct Ctx {
|
|||
}
|
||||
|
||||
impl Ctx {
|
||||
pub async fn new(settings: Settings) -> Arc<Self> {
|
||||
pub async fn new(settings: Settings) -> Self {
|
||||
let results = HashMap::default();
|
||||
let results = Arc::new(RwLock::new(results));
|
||||
let client = Client::default();
|
||||
let db = get_db(&settings).await;
|
||||
Arc::new(Self {
|
||||
Self {
|
||||
settings,
|
||||
client,
|
||||
db,
|
||||
results,
|
||||
docker: Arc::new(Docker::new()),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ pub fn launch_init_containers(ctx: &AppCtx, target: &Target) -> Option<Vec<Archi
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use url::Url;
|
||||
|
||||
use super::*;
|
||||
|
@ -59,11 +61,14 @@ mod tests {
|
|||
#[actix_rt::test]
|
||||
async fn launch_init_containers_works() {
|
||||
let settings = Settings::new().unwrap();
|
||||
let ctx = AppCtx::new(Ctx::new(settings.clone()).await);
|
||||
let ctx = AppCtx::new(Arc::new(Ctx::new(settings.clone()).await));
|
||||
// let base_dir = Path::new(&ctx.settings.repository.base_dir);
|
||||
// let control = base_dir.join("control");
|
||||
|
||||
let compose = DockerCompose::new("../ftest-control/targets/forgejo".into());
|
||||
let compose = DockerCompose::new(
|
||||
"../ftest-control/targets/forgejo".into(),
|
||||
ctx.docker.clone(),
|
||||
);
|
||||
compose.up();
|
||||
|
||||
let mut env_vars: HashMap<String, String> = HashMap::new();
|
||||
|
|
Loading…
Reference in a new issue