feat: add tests to check if forge type is loaded into DB
This commit is contained in:
parent
2a8283acc0
commit
99fabab5bc
2 changed files with 16 additions and 0 deletions
|
@ -81,6 +81,9 @@ pub trait SCDatabase: std::marker::Send + std::marker::Sync + CloneSPDatabase {
|
|||
|
||||
/// check if a forge instance exists
|
||||
async fn forge_exists(&self, hostname: &str) -> DBResult<bool>;
|
||||
|
||||
/// check if forge type exists
|
||||
async fn forge_type_exists(&self, forge_type: &ForgeImplementation) -> DBResult<bool>;
|
||||
}
|
||||
|
||||
/// Trait to clone SCDatabase
|
||||
|
|
|
@ -27,3 +27,16 @@ pub async fn adding_forge_works<T: SCDatabase>(
|
|||
db.create_forge_isntance(&create_forge_msg).await.unwrap();
|
||||
assert!(db.forge_exists(create_forge_msg.hostname).await.unwrap(), "forge creation failed, forge existance check failure");
|
||||
}
|
||||
|
||||
|
||||
/// test if all forge type implementations are loaded into DB
|
||||
pub async fn forge_type_exists_helper<T: SCDatabase>(db: &T) {
|
||||
for f in [
|
||||
ForgeImplementation::Gitea
|
||||
]
|
||||
.iter()
|
||||
{
|
||||
println!("Testing forge implementation exists for: {}", f.to_str());
|
||||
assert!(db.forge_type_exists(f).await.unwrap());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue