Skip to content

Commit 3de5be8

Browse files
committed
[core] allow to specify a test state sequence upon DCS requests
When ECS2DCS2ECS is used as the DCS server, one can specify expected reply to requests by adding "STATE_SEQUENCE" to request extra parameters with a key formatted as below: ``` MILLIS_DELAY:DETECTOR_STATE[,MILLIS_DELAY:DETECTOR_STATE]* ``` This commit exposes a possibility to set these sequences via configuration parameters. Essentially, this allows us to have some configurations on staging which use DCS with pre-defined state sequences.
1 parent e07b4e8 commit 3de5be8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

core/integration/dcs/plugin.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,13 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
640640
detectorArgMap = addEnabledLinks(detectorArgMap, varStack, ecsDet,
641641
log.WithField("detector", ecsDet))
642642

643+
// a state sequence that can be defined in order to get an expected answer, useful for testing.
644+
// format: MILLIS_DELAY:DETECTOR_STATE[,MILLIS_DELAY:DETECTOR_STATE]*
645+
pfrStateSequence, ok := varStack["dcs_pfr_state_sequence"]
646+
if ok {
647+
detectorArgMap["STATE_SEQUENCE"] = pfrStateSequence
648+
}
649+
643650
in.Detectors[i] = &dcspb.DetectorOperationRequest{
644651
Detector: dcsDet,
645652
ExtraParameters: detectorArgMap,
@@ -1255,6 +1262,13 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
12551262
detectorArgMap = addEnabledLinks(detectorArgMap, varStack, ecsDet,
12561263
log.WithField("detector", ecsDet))
12571264

1265+
// a state sequence that can be defined in order to get an expected answer, useful for testing.
1266+
// format: MILLIS_DELAY:DETECTOR_STATE[,MILLIS_DELAY:DETECTOR_STATE]*
1267+
sorStateSequence, ok := varStack["dcs_sor_state_sequence"]
1268+
if ok {
1269+
detectorArgMap["STATE_SEQUENCE"] = sorStateSequence
1270+
}
1271+
12581272
in.Detectors[i] = &dcspb.DetectorOperationRequest{
12591273
Detector: dcsDet,
12601274
ExtraParameters: detectorArgMap,
@@ -1740,6 +1754,12 @@ func (p *Plugin) CallStack(data interface{}) (stack map[string]interface{}) {
17401754

17411755
return
17421756
}
1757+
// a state sequence that can be defined in order to get an expected answer, useful for testing.
1758+
// format: MILLIS_DELAY:DETECTOR_STATE[,MILLIS_DELAY:DETECTOR_STATE]*
1759+
eorStateSequence, ok := varStack["dcs_eor_state_sequence"]
1760+
if ok {
1761+
detectorArgMap["STATE_SEQUENCE"] = eorStateSequence
1762+
}
17431763

17441764
in.Detectors[i] = &dcspb.DetectorOperationRequest{
17451765
Detector: dcsDet,

0 commit comments

Comments
 (0)