-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat : added tests for increasing coverage * feat : added mongo db tests and fixtures and updated the ci for tests * update : removed unwanted fixtures * update : removed unwanted fixtures * update : added mongo db runner in ci * update : added mongo db runner in ci * update : added mongo db runner in ci * update : updated with new changes and ci * update : updated test cases for s3 client * update : added .env.test file in the commit * feat : added database necessary tests * feat : added database necessary tests * Revert "feat : added database necessary tests" This reverts commit 65d66e6. * Revert "feat : added database necessary tests" This reverts commit 906a1eb. * update: Replaced Build_Config Fixture with TestConfigBuilder * update : config update * update : test_put_and_get_data_s3 test * update: moved testconfigbuilder to tests/config.rs & added docs , drop all collections not just jobs * feat : create job test case error returning * mock job handler * feat : added jobs test and modified worker tests * feat : added queue checks to tests and revamped some tests * feat : updated tests and resolved comments * feat : updated test config and added config type to aws s3 config * feat : updated tests and test names * feat : lint fixes * feat : lint fixes * feat : lint fixes * chore: resolved pr comments * Update crates/orchestrator/src/tests/database/mod.rs Co-authored-by: 0xevolve <Artevolve@yahoo.com> * chore : lint fixes * feat : lint fix * fix : coverage tests fix * fix : test fix * fix : updated region in localstack .env.test * feat : updated region * debug : added debug log to github ci * feat : updated queue code for test fixes * fix : sqs region fix * debug : added debug logs for ci debugging * feat : added override endpoint to queue url in producer and consumer * feat : added override endpoint to queue url in producer and consumer * fix : removed logs and refactored the code * chore : refactor code --------- Co-authored-by: Heemank Verma <heemankv@gmail.com> Co-authored-by: apoorvsadana <95699312+apoorvsadana@users.noreply.github.com> Co-authored-by: 0xevolve <Artevolve@yahoo.com>
- Loading branch information
1 parent
c155210
commit b905890
Showing
19 changed files
with
840 additions
and
116 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,65 @@ | ||
use mockall::automock; | ||
|
||
#[automock] | ||
pub mod factory { | ||
use std::sync::Arc; | ||
|
||
#[allow(unused_imports)] | ||
use mockall::automock; | ||
|
||
use crate::jobs::types::JobType; | ||
use crate::jobs::{da_job, proving_job, snos_job, state_update_job, Job}; | ||
|
||
/// To get the job handler | ||
// +-------------------+ | ||
// | | | ||
// | Arc<Box<dyn Job>>| | ||
// | | | ||
// +--------+----------+ | ||
// | | ||
// | +----------------+ | ||
// | | | | ||
// +--->| Box<dyn Job> | | ||
// | | | | ||
// | +----------------+ | ||
// | | | ||
// | | | ||
// +-------v-------+ | | ||
// | | | | ||
// | Closure 1 | | | ||
// | | | | ||
// +---------------+ | | ||
// | | ||
// +---------------+ | | ||
// | | | | ||
// | Closure x | | | ||
// | | | | ||
// +---------------+ | | ||
// | | ||
// | | ||
// v | ||
// +--------------+ | ||
// | | | ||
// | dyn Job | | ||
// | (job_handler)| | ||
// | | | ||
// +--------------+ | ||
/// We are using Arc so that we can call the Arc::clone while testing that will point | ||
/// to the same Box<dyn Job>. So when we are mocking the behaviour : | ||
/// | ||
/// - We create the MockJob | ||
/// - We return this mocked job whenever a function calls `get_job_handler` | ||
/// - Making it an Arc allows us to return the same MockJob in multiple calls to `get_job_handler`. This is needed because `MockJob` doesn't implement Clone | ||
pub async fn get_job_handler(job_type: &JobType) -> Arc<Box<dyn Job>> { | ||
// Original implementation | ||
let job: Box<dyn Job> = match job_type { | ||
JobType::DataSubmission => Box::new(da_job::DaJob), | ||
JobType::SnosRun => Box::new(snos_job::SnosJob), | ||
JobType::ProofCreation => Box::new(proving_job::ProvingJob), | ||
JobType::StateTransition => Box::new(state_update_job::StateUpdateJob), | ||
_ => unimplemented!("Job type not implemented yet."), | ||
}; | ||
|
||
Arc::new(job) | ||
} | ||
} |
Oops, something went wrong.