pub trait EnvController {
type DB: Database;
// Required methods
fn start<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
env: &'life1 str,
config: Option<&'life2 Path>,
) -> Pin<Box<dyn Future<Output = Self::DB> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn stop<'life0, 'life1, 'async_trait>(
&'life0 self,
env: &'life1 str,
database: Self::DB,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
Controller of test environments.
Environments usually stand for different start or deploy manner,
like standalone versus cluster etc. EnvController
is sort of Database
“factory” - it create different Database
s with different environment
mode parameter.
Environments are distingushed via the mode name (see the signature of
Self::start
and Self::stop
). Those names are extracted from the first-level
directories of test case directory. Refer to crate level documentation for more information
about directory organizaiton rules.
Required Associated Types§
Required Methods§
Sourcefn start<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
env: &'life1 str,
config: Option<&'life2 Path>,
) -> Pin<Box<dyn Future<Output = Self::DB> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn start<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
env: &'life1 str,
config: Option<&'life2 Path>,
) -> Pin<Box<dyn Future<Output = Self::DB> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Start a Database
to run test queries.
Two parameters are the mode of this environment, or environment’s name.
And the config file’s path to this environment if it’s find, it’s defined
by the env_config_file
field in the root config toml, and the default
value is config.toml
.