Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Dunitrust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nodes
rust
Dunitrust
Merge requests
!256
load conf from env vars as a priority
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
load conf from env vars as a priority
elois/141
into
dev
Overview
0
Commits
9
Pipelines
0
Changes
2
Merged
Éloïs
requested to merge
elois/141
into
dev
5 years ago
Overview
0
Commits
9
Pipelines
0
Changes
2
Expand
Closes
#141 (closed)
Edited
5 years ago
by
Éloïs
0
0
Merge request reports
Viewing commit
996d49cf
Prev
Next
Show latest version
2 files
+
107
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
996d49cf
[tests] module: create ModuleTest for tests that need a DursModule
· 996d49cf
Éloïs
authored
5 years ago
lib/core/module/src/module_test.rs
0 → 100644
+
106
−
0
Options
// Copyright (C) 2017-2019 The AXIOM TEAM Association.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! Define a test module for automated tests
use
crate
::
*
;
use
std
::
marker
::
PhantomData
;
/// Module test
#[derive(Debug)]
pub
struct
ModuleTest
<
DC
:
DursConfTrait
,
M
:
ModuleMessage
>
{
phantom
:
PhantomData
<
DC
>
,
phantom2
:
PhantomData
<
M
>
,
}
/// Module test user config
#[derive(Clone,
Debug,
Default,
Deserialize,
PartialEq,
Serialize)]
pub
struct
ModuleTestUserConf
{
/// Field 1
pub
field1
:
Option
<
String
>
,
/// Field 2
pub
field2
:
Option
<
usize
>
,
}
impl
Merge
for
ModuleTestUserConf
{
fn
merge
(
self
,
other
:
Self
)
->
Self
{
ModuleTestUserConf
{
field1
:
self
.field1
.or
(
other
.field1
),
field2
:
self
.field2
.or
(
other
.field2
),
}
}
}
/// Module test config
#[derive(Clone,
Debug,
Default,
Deserialize,
PartialEq)]
pub
struct
ModuleTestConf
{
field1
:
String
,
field2
:
usize
,
}
#[derive(StructOpt,
Debug,
Clone)]
#[structopt(name
=
"test"
,
setting(structopt::clap::AppSettings::ColoredHelp))]
/// Gva subcommand options
pub
struct
ModuleTestOpt
{
/// Field
#[structopt(long
=
"field"
)]
pub
field
:
Option
<
String
>
,
}
impl
<
DC
:
DursConfTrait
,
M
:
ModuleMessage
>
DursModule
<
DC
,
M
>
for
ModuleTest
<
DC
,
M
>
{
type
ModuleConf
=
ModuleTestConf
;
type
ModuleUserConf
=
ModuleTestUserConf
;
type
ModuleOpt
=
ModuleTestOpt
;
fn
name
()
->
ModuleStaticName
{
ModuleStaticName
(
"module_test"
)
}
fn
priority
()
->
ModulePriority
{
ModulePriority
::
Recommended
}
fn
ask_required_keys
()
->
RequiredKeys
{
RequiredKeys
::
None
}
fn
have_subcommand
()
->
bool
{
false
}
fn
generate_module_conf
(
_currency_name
:
Option
<&
CurrencyName
>
,
_global_conf
:
&<
DC
as
DursConfTrait
>
::
GlobalConf
,
_module_user_conf
:
Option
<
Self
::
ModuleUserConf
>
,
)
->
Result
<
(
Self
::
ModuleConf
,
Option
<
Self
::
ModuleUserConf
>
),
ModuleConfError
>
{
Ok
((
ModuleTestConf
::
default
(),
Some
(
ModuleTestUserConf
::
default
()),
))
}
fn
exec_subcommand
(
_soft_meta_datas
:
&
SoftwareMetaDatas
<
DC
>
,
_keys
:
RequiredKeysContent
,
_module_conf
:
Self
::
ModuleConf
,
_module_user_conf
:
Option
<
Self
::
ModuleUserConf
>
,
_subcommand_args
:
Self
::
ModuleOpt
,
)
->
Option
<
Self
::
ModuleUserConf
>
{
unimplemented!
()
}
fn
start
(
_soft_meta_datas
:
&
SoftwareMetaDatas
<
DC
>
,
_keys
:
RequiredKeysContent
,
_conf
:
Self
::
ModuleConf
,
_router_sender
:
std
::
sync
::
mpsc
::
Sender
<
RouterThreadMessage
<
M
>>
,
)
->
Result
<
(),
failure
::
Error
>
{
unimplemented!
()
}
}
Loading