1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-04 01:24:09 +02:00

enable running kaspersky tests

This commit is contained in:
Robin Appelman 2021-12-14 15:27:48 +01:00
commit abd37ff9a5
4 changed files with 21 additions and 8 deletions

View file

@ -1,4 +1,5 @@
use crate::config::HazeConfig;
use crate::exec::exec;
use crate::image::{image_exists, pull_image};
use crate::service::ServiceTrait;
use crate::Result;
@ -7,6 +8,7 @@ use bollard::models::{EndpointSettings, HostConfig};
use bollard::Docker;
use color_eyre::eyre::eyre;
use maplit::hashmap;
use std::io::Stdout;
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Kaspersky;
@ -18,7 +20,7 @@ impl ServiceTrait for Kaspersky {
}
fn env(&self) -> &[&str] {
&[]
&["KASPERSKY_HOST=kaspersky", "KASPERSKY_PORT=80"]
}
async fn spawn(
@ -61,8 +63,17 @@ impl ServiceTrait for Kaspersky {
Ok(id)
}
async fn is_healthy(&self, _docker: &Docker, _cloud_id: &str) -> Result<bool> {
Ok(true)
async fn is_healthy(&self, docker: &Docker, cloud_id: &str) -> Result<bool> {
let exit = exec(
docker,
self.container_name(cloud_id),
"root",
vec!["curl", "localhost/licenseinfo"],
vec![],
Option::<Stdout>::None,
)
.await?;
Ok(exit.to_result().is_ok())
}
fn container_name(&self, cloud_id: &str) -> String {