Skip to content

Commit

Permalink
add sequencer tests for sample rate (#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
noursaidi committed Jan 16, 2023
1 parent 4fb9130 commit 0f13ffb
Show file tree
Hide file tree
Showing 60 changed files with 2,854 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .gencode_hash.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ b35646a2f3d7c30fd34e3ea6ab6a1070b39c469fd1de49cab1093ff32faaf06d gencode/docs/c
73b3beb740f5bc3ff26d173c356b2d3bf3b9892be83a704d3eeee7c9ff030230 gencode/docs/config_mapping.html
cc4bb19794042f88f3a72b197b4d21736e5cebf6ec47ffac560430e9f580181f gencode/docs/configuration_endpoint.html
b7ca70e3176f997f254c32bd8d53dff1462ac8a71c0e166aaa85193d67bff60b gencode/docs/configuration_execution.html
eea5539a01240b0839b0e73a48da14fbbbe759d14e9cd227ad3f4775934f216d gencode/docs/configuration_pubber.html
fa89df05f3db9b27f96b65d89d3fef4aa3c8ad8e758fcfc123627f88bf600d00 gencode/docs/configuration_pubber.html
0f0355e343cb8197dfbae1481c0eca3a0566d73181bc968e33fd469a1c94d1e6 gencode/docs/envelope.html
92da453dec3e27493216f8c3672b6203be9eb9b3086741c22fda9432c22504b7 gencode/docs/event.html
e81e06349dd9d88a57d7f6119da1fee2832b07fe8190b6df139e26777e7e76bc gencode/docs/event_discovery.html
Expand Down Expand Up @@ -87,7 +87,7 @@ fc3a9415c04d8a06954dbdbfdff5d68ab113cce3948532c19df555778ffb04fa gencode/java/u
ca2e7566106818ca7e5190c8041eb86f0c9b3251b0bda8c3ea7ce11a0c891a0a gencode/java/udmi/schema/Position.java
3df66bb1a37a9e0b2b6cf392f8c64d404a73c83e5e13c02bb4844f09b9a04b70 gencode/java/udmi/schema/Properties.java
783320700f7e96cf8e421461f14999afca10cd540ca6aadf184add39f0ac048c gencode/java/udmi/schema/PubberConfiguration.java
997acde04cef70d3f6d009a21f3ce4f3d06e6c3093736c03fdc82d78ffea1aa8 gencode/java/udmi/schema/PubberOptions.java
839d78a89be33e25e10c40380d73bf2c23ce2ba3ab82d72b0031a509de35cf90 gencode/java/udmi/schema/PubberOptions.java
7bc53cb9a61df8f804a75aa4860403d19281f7c665cbddd5364a2aa746a1f651 gencode/java/udmi/schema/ReflectorConfig.java
abe99dd74122c186403baa6982300a9d5968f8bbb7a67b1689104111b98f32fb gencode/java/udmi/schema/ReflectorState.java
362499688dd17f0596e5d6f064db0fe3bb3f3a25bdf01319624ba423de779220 gencode/java/udmi/schema/SetupReflectorConfig.java
Expand Down Expand Up @@ -158,7 +158,7 @@ ee9c02c35438fb7d9aacb15a21ec7b35b533c1000d0bde044ec3923b1fdccca4 gencode/python
15b349141ebae651c6c3c5c313b197d49c8b2b44e8ff1b0639848ad42e5c4e63 gencode/python/udmi/schema/model_system_hardware.py
aafe6e70c281152db958adf77a024e3e9fab8293927106297c5ec48c11f54e27 gencode/python/udmi/schema/model_testing.py
5c50847e136a033ea511209238bb570499b43fbee6189dae06603132dcb9f01f gencode/python/udmi/schema/model_testing_target.py
e8e694e260bb70998d228e14516b2fedb7e9d82e68f5586a7e78d0573bd2de8b gencode/python/udmi/schema/options_pubber.py
15f421a67f0d985225aa5e0565851bcf0ae58bed02fc7342b04aba7242920ff6 gencode/python/udmi/schema/options_pubber.py
6c5f3dd1c5ca9d821e3c48298af118fc7eafd97af9265dfd34b2ed8642efca77 gencode/python/udmi/schema/persistent_device.py
a58f8c98e837a5b56126ca0f410e02f1e9cfcd80a8cb429e0ef522defab1f690 gencode/python/udmi/schema/properties.py
5dad0f2ee3e94ec32d11d1de3bfde35d087d3561ee18c0a9eeb0722d17d0f58a gencode/python/udmi/schema/reflect_config.py
Expand Down
5 changes: 5 additions & 0 deletions bin/test_itemized
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ cat <<EOF > $udmi_profile
}
EOF

pubber/bin/build
validator/bin/build

bin/reset_config $SITE_PATH $PROJECT_ID $DEVICE_ID

while read -u 7 action test_name remainder; do
if [[ $action != TEST ]]; then
continue;
Expand Down
28 changes: 28 additions & 0 deletions docs/specs/sequences/generated.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Some caveats:
* [multi_enumeration](#multi_enumeration)
* [periodic_scan](#periodic_scan)
* [pointset_enumeration](#pointset_enumeration)
* [pointset_publish_interval](#pointset_publish_interval): test sample rate and sample limit sec
* [pointset_sample_rate](#pointset_sample_rate): device publishes pointset events at a rate of no more than config sample_rate_sec
* [single_scan](#single_scan)
* [system_last_update](#system_last_update): Check that last_update state is correctly set in response to a config update.
* [system_min_loglevel](#system_min_loglevel): Check that the min log-level config is honored by the device.
Expand Down Expand Up @@ -259,6 +261,32 @@ Check that the device correctly handles an extra out-of-schema field
1. Check that no feature enumeration
1. Check that points enumerated 3

## pointset_publish_interval

test sample rate and sample limit sec

1. Update config before receive at least 4 pointset events:
* Add `pointset.sample_rate_sec` = `8`
* Add `pointset.sample_limit_sec` = `5`
1. Wait for receive at least 4 pointset events
1. Check that time period between successive pointset events is between 5 and 8 seconds
1. Update config before receive at least 4 pointset events:
* Set `pointset.sample_rate_sec` = `18`
* Set `pointset.sample_limit_sec` = `15`
1. Wait for receive at least 4 pointset events
1. Check that time period between successive pointset events is between 15 and 18 seconds

## pointset_sample_rate

device publishes pointset events at a rate of no more than config sample_rate_sec

1. Wait for measure initial sample rate
1. Update config before receive at least 5 pointset events:
* Add `pointset.sample_rate_sec` = `5`
* Add `pointset.sample_limit_sec` = `1`
1. Wait for receive at least 5 pointset events
1. Check that time period between successive pointset events is between 1 and 5 seconds

## single_scan

1. Update config before all scans not active:
Expand Down
2 changes: 2 additions & 0 deletions etc/sequencer.out
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ RESULT pass feature_enumeration ALPHA Sequence complete
RESULT pass multi_enumeration ALPHA Sequence complete
RESULT pass periodic_scan Sequence complete
RESULT pass pointset_enumeration ALPHA Sequence complete
RESULT pass pointset_publish_interval ALPHA Sequence complete
RESULT pass pointset_sample_rate ALPHA Sequence complete
RESULT pass single_scan Sequence complete
RESULT pass system_last_update Sequence complete
RESULT pass system_min_loglevel BETA Sequence complete
Expand Down
1 change: 1 addition & 0 deletions etc/test_itemized.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
TEST writeback_success noWriteback RESULT fail writeback_success timeout waiting for point filter_differential_pressure_setpoint to have value_state applied
TEST writeback_success noPointState RESULT fail writeback_success timeout waiting for point filter_differential_pressure_setpoint to have value_state applied
TEST pointset_sample_rate fixedSampleRate=10 RESULT fail pointset_sample_rate ALPHA Failed check that time period between successive pointset events is between 1 and 5 seconds
40 changes: 40 additions & 0 deletions gencode/docs/configuration_pubber.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion gencode/java/udmi/schema/PubberOptions.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions gencode/python/udmi/schema/options_pubber.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions pubber/src/main/java/daq/pubber/Pubber.java
Original file line number Diff line number Diff line change
Expand Up @@ -909,15 +909,17 @@ private void processConfigUpdate(Config config) {
deviceConfig = config;
info(String.format("%s received config %s", getTimestamp(), isoConvert(config.timestamp)));
deviceState.system.last_config = config.timestamp;
actualInterval = updateSystemConfig(config.pointset);
updatePointsetConfig(config.pointset);
actualInterval = updatePointsetConfig(config.pointset);
updatePointsetPointsConfig(config.pointset);
updateDiscoveryConfig(config.discovery);
extractEndpointBlobConfig();
} else {
info(getTimestamp() + " defaulting empty config");
actualInterval = DEFAULT_REPORT_SEC * 1000;
}
maybeRestartExecutor(actualInterval);
int useInterval = configuration.options.fixedSampleRate == null
? actualInterval : configuration.options.fixedSampleRate * 1000;
maybeRestartExecutor(useInterval);
}

EndpointConfiguration extractEndpointBlobConfig() {
Expand Down Expand Up @@ -1346,7 +1348,7 @@ private String isoConvert(Date timestamp) {
}
}

private void updatePointsetConfig(PointsetConfig pointsetConfig) {
private void updatePointsetPointsConfig(PointsetConfig pointsetConfig) {
PointsetConfig useConfig = pointsetConfig != null ? pointsetConfig : new PointsetConfig();
Map<String, PointPointsetConfig> points =
useConfig.points != null ? useConfig.points : new HashMap<>();
Expand All @@ -1363,7 +1365,7 @@ private void updatePointConfig(AbstractPoint point, PointPointsetConfig pointCon
updateState(point);
}

private int updateSystemConfig(PointsetConfig pointsetConfig) {
private int updatePointsetConfig(PointsetConfig pointsetConfig) {
final int actualInterval;
boolean hasSampleRate = pointsetConfig != null && pointsetConfig.sample_rate_sec != null;
int reportInterval = hasSampleRate ? pointsetConfig.sample_rate_sec : DEFAULT_REPORT_SEC;
Expand Down
3 changes: 3 additions & 0 deletions schema/options_pubber.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"description": "Pubber runtime options",
"additionalProperties": true,
"properties": {
"fixedSampleRate": {
"type": "integer"
},
"noHardware": {
"type": "boolean"
},
Expand Down
10 changes: 10 additions & 0 deletions validator/sequences/pointset_publish_interval/config_pointset.attr

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions validator/sequences/pointset_publish_interval/config_pointset.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions validator/sequences/pointset_publish_interval/config_system.attr

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions validator/sequences/pointset_publish_interval/config_system.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions validator/sequences/pointset_publish_interval/config_update.attr

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions validator/sequences/pointset_publish_interval/config_update.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions validator/sequences/pointset_publish_interval/event_pointset.attr

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions validator/sequences/pointset_publish_interval/event_pointset.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions validator/sequences/pointset_publish_interval/event_system.attr

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions validator/sequences/pointset_publish_interval/event_system.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0f13ffb

Please sign in to comment.