Skip to content

Commit

Permalink
Split writeback tests (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
noursaidi committed Nov 10, 2022
1 parent 167f8b3 commit 524dd06
Show file tree
Hide file tree
Showing 121 changed files with 5,307 additions and 621 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 @@ e1f62882576d0f4332360f2aedb79b37a43973fb31d862c829af924f8f310ec1 gencode/docs/c
30c7f39e50e290b0a36a3414cf1c90277ebd249f126f85f0a307bc7b74164e08 gencode/docs/config_mapping.html
51633513052c10d16fdc1bada9860c75fc0d1d5a9b8d6f9457e2845cfe4e750e gencode/docs/configuration_endpoint.html
b7ca70e3176f997f254c32bd8d53dff1462ac8a71c0e166aaa85193d67bff60b gencode/docs/configuration_execution.html
62638ad874d650e937e1b08cdf11a31b2726bae7a7e733fcce1ab904395d895a gencode/docs/configuration_pubber.html
7b7d42d19e15aa64f5e57dd3c8867e72279365c7f39405c512aa572f7e97f527 gencode/docs/configuration_pubber.html
0f0355e343cb8197dfbae1481c0eca3a0566d73181bc968e33fd469a1c94d1e6 gencode/docs/envelope.html
f1fde870638541bea6de16acd64365c89a7d56ee3270d6fd1bcdbb5bdb141887 gencode/docs/event.html
a8800ab8384de3b846af0d72cf310acf01644842b557e42eec20b69a0bfa1868 gencode/docs/event_discovery.html
Expand Down Expand Up @@ -83,7 +83,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
a5737c70324cf13322c019049f80e334bf699dea2f434859762fe3553fee8308 gencode/java/udmi/schema/PubberOptions.java
997acde04cef70d3f6d009a21f3ce4f3d06e6c3093736c03fdc82d78ffea1aa8 gencode/java/udmi/schema/PubberOptions.java
7bc53cb9a61df8f804a75aa4860403d19281f7c665cbddd5364a2aa746a1f651 gencode/java/udmi/schema/ReflectorConfig.java
abe99dd74122c186403baa6982300a9d5968f8bbb7a67b1689104111b98f32fb gencode/java/udmi/schema/ReflectorState.java
5a44075bc03f2b9b2cc090f007fd1692832871f0981dcb02579d8dda96a96206 gencode/java/udmi/schema/SetupReflectorConfig.java
Expand Down Expand Up @@ -149,7 +149,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
a10a7e593d8747ea46c56da2c24c7b0501c10b190c5b66119cab8e71d2bdc0e6 gencode/python/udmi/schema/options_pubber.py
e8e694e260bb70998d228e14516b2fedb7e9d82e68f5586a7e78d0573bd2de8b gencode/python/udmi/schema/options_pubber.py
6c5f3dd1c5ca9d821e3c48298af118fc7eafd97af9265dfd34b2ed8642efca77 gencode/python/udmi/schema/persistent_device.py
a58f8c98e837a5b56126ca0f410e02f1e9cfcd80a8cb429e0ef522defab1f690 gencode/python/udmi/schema/properties.py
1f521678016ad267ad1c817896c7900ba30a85fc694669577b71148193db32c1 gencode/python/udmi/schema/reflect_config.py
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
name: Integration Tests
runs-on: ubuntu-latest
needs: redirect # Access to UDMI-REFLECTOR is mutually exclusive
timeout-minutes: 20
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
Expand Down Expand Up @@ -130,6 +130,15 @@ jobs:
ls -1 sites/udmi_site_model/out/devices/AHU-1/tests/ | xargs -I% diff -u \
sites/udmi_site_model/out/devices/AHU-1/tests/%/sequence.md \
validator/sequences/%/sequence.md
- name: itemized sequencer tests
env:
GCP_TARGET_PROJECT: ${{ secrets.GCP_TARGET_PROJECT }}
SEQUENCER_OPTS: ${{ secrets.SEQUENCER_OPTS }}
if: "${{ env.GCP_TARGET_PROJECT != '' }}"
run: |
bin/test_itemized $GCP_TARGET_PROJECT
more /tmp/test_itemized.out
diff -u /tmp/test_itemized.out etc/test_itemized.out
- name: output logs
if: ${{ always() }}
run: |
Expand Down
13 changes: 11 additions & 2 deletions bin/gencode_docs_checklinks
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Prints any invalid links, otherwise quiet if all links are valid
import glob
import re
import os
import sys

HOSTED_GITHUB_PAGES = r'^https?:\/\/faucetsdn\.github\.io\/udmi\/'
HOSTED_GITHUB = r'^https?:\/\/(?:www\.)?github\.com\/faucetsdn\/udmi\/(?:blob|tree)\/master\/'
Expand Down Expand Up @@ -99,12 +100,20 @@ def check_links(file_path):
return failing_links


if __name__ == "__main__":
check_paths = ['*.md', 'docs/**/*.md', 'schema/*.json']
def main():
check_paths = ['*.md', 'docs/**/*.md', 'schema/*.json', 'udmif/**/*.md']
error = False
for check_path in check_paths:
file_paths = glob.glob(check_path, recursive=True)
for file_path in file_paths:
invalid_tuples = check_links(file_path)
if invalid_tuples:
error = True
for invalid_tuple in invalid_tuples:
print(f'** {invalid_tuple[0]} {invalid_tuple[1]} {invalid_tuple[2]}')
return error

if __name__ == "__main__":
result = main()
if result:
sys.exit(1)
51 changes: 51 additions & 0 deletions bin/test_itemized
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash -e

PROJECT_ID=$1
shift 1

SITE_PATH=sites/udmi_site_model
DEVICE_ID=AHU-1

PUBBER_OUT=/tmp/pubber.log
SEQUENCER_OUT=/tmp/sequencer.log
RESULTS_OUT=/tmp/test_itemized.out
GOLDEN_FILE=etc/test_itemized.out

rm -f $RESULTS_OUT $SEQUENCER_OUT $PUBBER_OUT
touch $RESULTS_OUT $SEQUENCER_OUT $PUBBER_OUT

while read -u 7 action test_name remainder; do
if [[ $action != TEST ]]; then
continue;
fi
pubber_opts=${remainder/RESULT*/}

echo -n "TEST $test_name $pubber_opts" >> $RESULTS_OUT
echo "TEST $test_name $pubber_opts"

serial_no=sequencer-$RANDOM
bin/pubber $SITE_PATH $PROJECT_ID $DEVICE_ID $serial_no $pubber_opts > $PUBBER_OUT 2>&1 &
WAITING=60
for i in `seq 1 $WAITING`; do
if [[ -n $(fgrep "Connection complete" $PUBBER_OUT) ]]; then
break
fi
sleep 1
done

if [[ $i -eq $WAITING ]]; then
echo pubber startup failed:
cat $PUBBER_OUT
false
fi

bin/sequencer $SITE_PATH $PROJECT_ID $DEVICE_ID $serial_no $test_name 2>&1 | tee $SEQUENCER_OUT

kill $(ps ax | fgrep pubber | fgrep java | awk '{print $1}')

result=$(grep -E -m 1 "RESULT [a-z]+ $test_name " $SEQUENCER_OUT)
echo ${result/*sequencer RESULT/RESULT} >> $RESULTS_OUT

sleep 2

done 7< $GOLDEN_FILE
2 changes: 1 addition & 1 deletion docs/cloud/gcp/udmis.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# UDMIS

UDMIS (Universal Device Management Interface Services) is a cloud infrastructure which comprises cloud functions. These process messages according to the [sub-blocks API](../../specs/subblocks.md). This is required for the enablement of other applications and tooling e.g. [UDMIF](UDMIF Deployment](../../../udmif/deploy.md) and [validation tooling](../../tools/readme.md)
UDMIS (Universal Device Management Interface Services) is a cloud infrastructure which comprises cloud functions. These process messages according to the [sub-blocks API](../../specs/subblocks.md). This is required for the enablement of other applications and tooling e.g. [UDMIF](UDMIF Deployment](../../../../../udmif/deploy.md) and [validation tooling](../../tools/readme.md)

# Deployment

Expand Down
2 changes: 1 addition & 1 deletion docs/specs/message_walk.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ attention to.
## Cloud Functions

The first set of [Cloud Functions](https://cloud.google.com/functions/docs/) handle the ingest traffic
from a device. The [source code](../../dashboard/functions/) for these functions can be published
from a device. The [source code](../../udmis/functions/) for these functions can be published
to the cloud project by the `udmis/deploy_udmis_gcloud` command (see below).

* __udmi\_target__: Processes incoming device _event_ messages and writes them to the designated
Expand Down
32 changes: 25 additions & 7 deletions docs/specs/sequences/generated.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ Some caveats:
* [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.
* [valid_serial_no](#valid_serial_no)
* [writeback_states](#writeback_states)
* [writeback_failure_state](#writeback_failure_state)
* [writeback_invalid_state](#writeback_invalid_state)
* [writeback_success_apply](#writeback_success_apply)
* [writeback_success_state](#writeback_success_state)

## broken_config

Expand Down Expand Up @@ -156,15 +159,30 @@ Check that the min log-level config is honored by the device.

1. Check that received serial no matches

## writeback_states
## writeback_failure_state

1. Wait for point filter_differential_pressure_sensor to have value_state default (null)
1. Wait for point filter_alarm_pressure_status to have value_state default (null)
1. Wait for point filter_differential_pressure_setpoint to have value_state default (null)
1. Update config before point filter_differential_pressure_sensor to have value_state invalid:
1. Update config before point filter_alarm_pressure_status to have value_state failure:
* Add `pointset.points.filter_alarm_pressure_status.set_value` = `false`
* Set `pointset.points.filter_differential_pressure_setpoint.set_value` = `60`
1. Wait for point filter_alarm_pressure_status to have value_state failure

## writeback_invalid_state

1. Wait for point filter_differential_pressure_sensor to have value_state default (null)
1. Update config before point filter_differential_pressure_sensor to have value_state invalid:
* Add `pointset.points.filter_differential_pressure_sensor.set_value` = `15`
1. Wait for point filter_differential_pressure_sensor to have value_state invalid
1. Wait for point filter_alarm_pressure_status to have value_state failure

## writeback_success_apply

1. Update config before point `filter_differential_pressure_setpoint` to have present_value `60`:
* Set `pointset.points.filter_differential_pressure_setpoint.set_value` = `60`
1. Wait for point `filter_differential_pressure_setpoint` to have present_value `60`

## writeback_success_state

1. Wait for point filter_differential_pressure_setpoint to have value_state default (null)
1. Update config before point filter_differential_pressure_setpoint to have value_state applied:
* Set `pointset.points.filter_differential_pressure_setpoint.set_value` = `60`
1. Wait for point filter_differential_pressure_setpoint to have value_state applied
1. Wait for point `filter_differential_pressure_setpoint` to have present_value `60`
4 changes: 2 additions & 2 deletions docs/specs/site_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ The primary use of the site_model will be through the [registrar](../tools/regis

## `cloud_iot_config.json`

The [cloud_iot_config.json](../../schema/cloud_iot_config.json) schema specifies some cloud-centric
configuration parameters ([example](../../tests/cloud_iot_config.tests/cloud_iot_config.json)).
The [cloud_iot_config.json](../../schema/configuration_execution.json) schema specifies some cloud-centric
configuration parameters ([example](../../tests/configuration_execution.tests/cloud_iot_config.json)).

## `devices/`

Expand Down
2 changes: 1 addition & 1 deletion docs/specs/tech_stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Any backend system (in a GCP project) should adhere to the following guidelines:
* If necessary, any _config_ or _command_ messages should go through a PubSub topic, and then converted to the requisite Cloud IoT
config write using a simple cloud function.
* To make data persistent, it can be written to a back-end database, e.g. Firestore. See the `udmi_target` and
`udmi_state` [example cloud functions](../../dashboard/functions/index.js) for details.
`udmi_state` [example cloud functions](../../udmis/functions/index.js) for details.
* A similar function called `device_config` shows how PubSub can be used to update the Cloud IoT configuration.

A config push can be tested with something like:
Expand Down
File renamed without changes.
5 changes: 4 additions & 1 deletion etc/sequencer.out
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ RESULT pass valid_serial_no Sequence complete
RESULT pass valid_serial_no Sequence complete
RESULT pass valid_serial_no Sequence complete
RESULT pass valid_serial_no Sequence complete
RESULT pass writeback_states Sequence complete
RESULT pass writeback_failure_state Sequence complete
RESULT pass writeback_invalid_state Sequence complete
RESULT pass writeback_success_apply Sequence complete
RESULT pass writeback_success_state Sequence complete
2 changes: 2 additions & 0 deletions etc/test_itemized.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
TEST writeback_success_state noWriteback RESULT fail writeback_success_state timeout waiting for point filter_differential_pressure_setpoint to have value_state applied
TEST writeback_success_apply noPointState RESULT pass writeback_success_apply Sequence complete
122 changes: 122 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.

Loading

0 comments on commit 524dd06

Please sign in to comment.