forked from madara-alliance/madara-orchestrator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
write job tests, create new fixtures
- Loading branch information
1 parent
32be758
commit 36266ee
Showing
5 changed files
with
79 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use rstest::*; | ||
|
||
use crate::common::{ | ||
get_or_init_config, | ||
default_job_item, | ||
}; | ||
|
||
use orchestrator::{ | ||
config::Config, | ||
jobs::{ | ||
da_job::DaJob, | ||
types::{JobItem, JobType}, | ||
Job | ||
}, | ||
}; | ||
|
||
#[rstest] | ||
#[tokio::test] | ||
async fn test_create_job( | ||
#[future] get_or_init_config: &Config | ||
) { | ||
let config = get_or_init_config.await; | ||
let job = DaJob.create_job(&config, String::from("0")).await; | ||
assert!(job.is_ok()); | ||
|
||
let job = job.unwrap(); | ||
|
||
let job_type = job.job_type; | ||
assert_eq!(job_type, JobType::DataSubmission); | ||
assert_eq!(job.metadata.values().len(), 0, "metadata should be empty"); | ||
assert_eq!(job.external_id.unwrap_string().unwrap(), String::new(), "external_id should be empty string"); | ||
} | ||
|
||
#[rstest] | ||
// #[should_panic] | ||
#[tokio::test] | ||
async fn test_verify_job( | ||
#[future] #[from(get_or_init_config)] config: &Config, | ||
default_job_item: JobItem, | ||
) { | ||
let config = config.await; | ||
assert!(DaJob.verify_job(config, &default_job_item).await.is_err()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,2 @@ | ||
use super::common::get_or_init_config; | ||
use orchestrator::config::Config; | ||
use rstest::*; | ||
|
||
#[rstest] | ||
#[tokio::test] | ||
async fn test_abc( | ||
#[future] | ||
#[with( String::from("http://localhost:9944") )] | ||
get_or_init_config: &Config | ||
) { | ||
get_or_init_config.await; | ||
todo!("setting up the structure before writing the tests"); | ||
} | ||
#[cfg(test)] | ||
pub mod da_job; |