Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add base gateway sequence test #763

Merged
merged 55 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
4c88c9a
Updating device summaries
grafnu Nov 7, 2023
06f709b
Refacotring and adding base
grafnu Nov 7, 2023
204e9b9
Basic event proxy
grafnu Nov 7, 2023
bcea0ec
Adding proxyID
grafnu Nov 7, 2023
2725e26
Refactoring to envelope
grafnu Nov 7, 2023
c8ff2d7
Linty and NPE
grafnu Nov 7, 2023
7f99358
Minor refactoring
grafnu Nov 7, 2023
ec2eee4
Cleanup
grafnu Nov 7, 2023
be5a77b
Fix suffix calculation
grafnu Nov 7, 2023
0f6acbd
Cleanup
grafnu Nov 7, 2023
cb9cd95
Adding itemized test stuff
grafnu Nov 7, 2023
0cef5c5
Updating sequence cache
grafnu Nov 7, 2023
818017f
Adding sequencer.out
grafnu Nov 7, 2023
5d4d620
Fixing itemized debugging
grafnu Nov 7, 2023
10d6b83
Generalize not-a-gateway check
grafnu Nov 7, 2023
6daa3f1
Increasing shart count to 10
grafnu Nov 7, 2023
0e9439c
Adding combined itemized validation
grafnu Nov 7, 2023
a53f6d9
PASSING TESTS
grafnu Nov 7, 2023
9f52336
Fix generated.md
grafnu Nov 7, 2023
a6355ca
Fix sequcheck
grafnu Nov 8, 2023
81a2a1c
out
grafnu Nov 8, 2023
428dadf
Fix test run archiving
grafnu Nov 8, 2023
2e10789
Fix out merge
grafnu Nov 8, 2023
77af4ff
Fix combinatorics
grafnu Nov 8, 2023
a4defe3
Shard output cleanup
grafnu Nov 8, 2023
e4833ae
Don't error on missing combined
grafnu Nov 8, 2023
e647a6e
Clean-up out logging
grafnu Nov 8, 2023
0e513b1
Fix out/ combined
grafnu Nov 8, 2023
0c70d89
Cleanup itemized out
grafnu Nov 8, 2023
36519af
Remember to invoke super
grafnu Nov 8, 2023
5945434
Cleanup test_itemized out
grafnu Nov 8, 2023
f92c521
Fix itemized cleaniup
grafnu Nov 8, 2023
f673921
Don't agressively clean out/
grafnu Nov 8, 2023
60349ea
Increase node version
grafnu Nov 8, 2023
2319461
Fix some combination stuff
grafnu Nov 9, 2023
0968a91
Fix some out gathering
grafnu Nov 9, 2023
d9438ea
Add rsync suffixz
grafnu Nov 9, 2023
ee2fad7
Fix test combinations
grafnu Nov 9, 2023
2ef6589
Increse timeout for config ack check
grafnu Nov 9, 2023
0c411a5
Sort expected out
grafnu Nov 9, 2023
b8ae163
Adding more tests
grafnu Nov 9, 2023
bbe4088
Tweaking output
grafnu Nov 9, 2023
2554067
Rename test out files
grafnu Nov 9, 2023
205f2d9
Updatin gto latest test results
grafnu Nov 9, 2023
e9d4540
Fix pointset
grafnu Nov 9, 2023
c3aff25
Pubber code
grafnu Nov 9, 2023
c7600a5
Updating generated.md with new sequences
grafnu Nov 9, 2023
cdde4af
Updating itemized out
grafnu Nov 9, 2023
2b83ce0
Adding missing itemized out
grafnu Nov 9, 2023
665b7a8
Fixing schema capture
grafnu Nov 9, 2023
c72fa56
Fix schema out generation
grafnu Nov 9, 2023
1215ad5
Fix schema combination
grafnu Nov 9, 2023
e52baf4
Only sequence cache changes
grafnu Nov 9, 2023
c2f4e67
Merge branch 'master' into gatewaytest
grafnu Nov 9, 2023
12116c7
Merge branch 'master' into gatewaytest
grafnu Nov 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gencode_hash.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ d40bfc9f4a30c56986435dc08f1e5f42401e5ac043359a1e359011c913cad673 gencode/docs/c
08583688b20f892c0b453f41787ac01a46ac601663736bcd6ed6f57be0758e79 gencode/docs/configuration_endpoint.html
6cf94d6cb600c75cde32a64bd78acb3ed3b54adfad08dbf6bb159b467e8925c9 gencode/docs/configuration_execution.html
d0f6ea11943f46c955891b3b49a25a9bffcf558fcabb9ed2b0f7667d8413953b gencode/docs/configuration_pod.html
1f00351201985451aaa1a3e3247fc138b8bea7943b801c18cd5618f7600c872d gencode/docs/configuration_pubber.html
26d2fe3ecc9f95dff52cdd9eae3be621886ef264305f31f64aa8f254e7ffbf99 gencode/docs/configuration_pubber.html
96186777da06f95eae1d16d73555445d23608a9301636ea1ccd17922b3fe4019 gencode/docs/event.html
587e048c161273b927de67b899204bf0e183db64e59ae513f833e5eff406b1ab gencode/docs/event_discovery.html
0f99534574718e07e655e33e76e06b56e6a96a7a42ae1457dc97dabc581d848f gencode/docs/event_mapping.html
Expand Down Expand Up @@ -99,7 +99,7 @@ fc3a9415c04d8a06954dbdbfdff5d68ab113cce3948532c19df555778ffb04fa gencode/java/u
ca2e7566106818ca7e5190c8041eb86f0c9b3251b0bda8c3ea7ce11a0c891a0a gencode/java/udmi/schema/Position.java
3df66bb1a37a9e0b2b6cf392f8c64d404a73c83e5e13c02bb4844f09b9a04b70 gencode/java/udmi/schema/Properties.java
d5e11dc354995681b894bcb62e4e21da7f0be68aaa3643a3dc5aa13610741f29 gencode/java/udmi/schema/PubberConfiguration.java
3583ac57d4e5e7e0fc01081bf08cae368c4b90cdb4b337c4a72bc3e69c26046e gencode/java/udmi/schema/PubberOptions.java
3575b20afc5e1b38f0ac34799968270b301c3320915bd74b607e02d45c9e6eb4 gencode/java/udmi/schema/PubberOptions.java
703ed0cecb60f284b52e76dc4d612eb798ba3e8781cc40698a46611b36e6b0c9 gencode/java/udmi/schema/SchemaValidationState.java
6da1708f597a0c64ce30dcbe739095fc7ebc091d63b98af88c73f70706af31ca gencode/java/udmi/schema/SequenceValidationState.java
9da49b22341a65580d085fd9d00eaadcaefcf7b813988ef844c617aa4b8a9a4f gencode/java/udmi/schema/SetupUdmiConfig.java
Expand Down Expand Up @@ -182,7 +182,7 @@ b48ae013d203eb31cc388a084c0cc6f93d4d5534336d4da2ecbccd84a085ea2b gencode/python
5c50847e136a033ea511209238bb570499b43fbee6189dae06603132dcb9f01f gencode/python/udmi/schema/model_testing_target.py
7c9a755ae06c44fc2b8117d7918b6401ce08a7218b86033fb3320eda7286e581 gencode/python/udmi/schema/monitoring.py
3a3873c7db8d5fa13b43629031d36417a4ec4838d612a7b8c2fce7c22fdee009 gencode/python/udmi/schema/monitoring_metric.py
f32079e2cef51f6bcd8aeee3febf2af6aa177714ce7cdfe7164be6d776a866a8 gencode/python/udmi/schema/options_pubber.py
47feb547b1630546bfa7ed5a8de1c708f0f769b42fe1aac35f4b1cdacda865eb gencode/python/udmi/schema/options_pubber.py
6c5f3dd1c5ca9d821e3c48298af118fc7eafd97af9265dfd34b2ed8642efca77 gencode/python/udmi/schema/persistent_device.py
a58f8c98e837a5b56126ca0f410e02f1e9cfcd80a8cb429e0ef522defab1f690 gencode/python/udmi/schema/properties.py
e604cf0280fe772de5f4e5ecf10dc6c564b6177eeff9cd9fb8b385af8fe10a95 gencode/python/udmi/schema/state.py
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ jobs:
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3, 4, 5, 6, 7]
shard: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
if: vars.TARGET_PROJECT != ''
env:
TARGET_PROJECT: ${{ vars.TARGET_PROJECT }}
UDMI_ALT_REGISTRY: ZZ-REDIRECT-NA
UDMI_REGISTRY_SUFFIX: _${{ matrix.shard }}
MATRIX_SHARD_COUNT: 8
MATRIX_SHARD_COUNT: 10
MATRIX_SHARD_INDEX: ${{ matrix.shard }}
steps:
- uses: actions/checkout@v3
Expand All @@ -149,23 +149,25 @@ jobs:
run: bin/test_sequencer clean nocheck $TARGET_PROJECT
- name: sequence tests alpha
run: bin/test_sequencer alpha nocheck $TARGET_PROJECT
- name: sequence test timing
- name: sequence test post-process
if: ${{ always() }}
run: egrep ' test .* after .*s ' out/sequencer.log.combined
run: egrep ' test .* after .*s ' out/sequencer.log > out/timing_sequencer.out
- name: itemized sequencer tests
run: bin/test_itemized $TARGET_PROJECT
- name: itemized test timing
if: ${{ always() }}
run: egrep ' test .* after .*s ' out/sequencer.log-*
- name: output files
if: ${{ always() }}
run: more out/*.out* | cat
- name: pubber logs
if: ${{ always() }}
run: more out/pubber.log* pubber/out/*.json | cat
- name: itemized test post-process
if: ${{ always() }}
run: egrep ' test .* after .*s ' out/sequencer.log-* > out/timing_itemized.out
- name: support bundle
if: ${{ always() }}
run: bin/support ${{ github.repository_owner }}_${{ github.job }}_
run: |
ls -lrt out*/ sites/udmi_site_model/out*/
bin/support ${{ github.repository_owner }}_${{ github.job }}_
- uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
Expand Down Expand Up @@ -277,3 +279,5 @@ jobs:
find out* -name 'schema*.out*' -size +0 | xargs more | cat
- name: Sequencer validation
run: bin/test_sequcheck
- name: Itemized validation
run: bin/test_itemcheck
11 changes: 9 additions & 2 deletions bin/support_process
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ elif [[ ! -d $archive ]]; then
fi

ls -l $archive_dir/
echo Extracting test archives...
ls $archive_dir/*sequencer*.tgz | xargs -n 1 tar -xzf

find $sites_in -name out-seq -print -exec rsync -ah {}/ $sites_out/ \;
echo Consolidating device tests...
devices=$(ls -d $sites_in/out-seq/devices)
for devices_dir in $devices; do
rsync -ah $devices_dir/ $sites_out/devices/
done

src_count=$(find $sites_in/out-seq -name sequence.md | wc -l)
dst_count=$(find $sites_out -name sequence.md | wc -l)
Expand All @@ -52,7 +57,9 @@ fi
echo Restored $dst_count test output files to $sites_out

cat out_*/sequencer.out.combined | sort -k 4 > out/sequencer.out
cat out_*/schema.out.combined | sort -k 4 | uniq > out/schema.out
cat out_*/schema.out.combined | fgrep RESULT | sort -k 4 | uniq > out/schema.out
cat out_*/test_itemized.out | sort -k 4 > out/test_itemized.out
cat out_*/schema_itemized.out | sort | uniq > out/schema_itemized.out

echo Restored combined schema.out files.

Expand Down
15 changes: 15 additions & 0 deletions bin/test_itemcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash -e

ROOT_DIR=$(dirname $0)/..
cd $ROOT_DIR

RESULTS_OUT=out/test_itemized.out
GOLDEN_FILE=etc/test_itemized.out
SCHEMA_OUT=out/schema_itemized.out
GOLDEN_SCHEMAS=etc/schema_itemized.out

echo Comparing diff $RESULTS_OUT $GOLDEN_FILE
diff -bu $RESULTS_OUT $GOLDEN_FILE

echo Comparing diff $SCHEMA_OUT $GOLDEN_SCHEMAS
diff -bu $SCHEMA_OUT $GOLDEN_SCHEMAS
56 changes: 28 additions & 28 deletions bin/test_itemized
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@ DEVICE_ID=AHU-1
seq_opts=-v
serial_no=sequencer-$RANDOM

PUBBER_LOG=out/pubber.log
SEQUENCER_LOG=out/sequencer.log
SEQUENCER_OUT=out/sequencer.out
INPUT_FILE=etc/test_itemized.in
RESULTS_OUT=out/test_itemized.out
GOLDEN_FILE=etc/test_itemized.out
SCHEMA_OUT=out/schema_itemized.out
SCHEMA_ITEMIZED=out/schema_itemized.out
GOLDEN_SCHEMAS=etc/schema_itemized.out
AUGMENT_OPTS=out/augment_opts.txt

rm -rf out/*_itemized.out
mkdir -p out
echo > $AUGMENT_OPTS

Expand All @@ -38,17 +36,24 @@ echo "export MATRIX_SHARD_INDEX=$MATRIX_SHARD_INDEX"
pubber/bin/build
validator/bin/build

test_index=-1
test_index=0
while read -u 7 action test_name pubber_opts; do
rm -f $RESULTS_OUT $SEQUENCER_OUT $PUBBER_LOG $SCHEMA_OUT $SEQUENCER_LOG
mkdir -p out
test_marker=$(printf %02d $test_index)
((test_index++)) || true

PUBBER_LOG=out/pubber.log-$test_marker
SEQUENCER_LOG=out/sequencer.log
SEQUENCER_OUT=out/sequencer.out
SCHEMA_OUT=out/schema.out

if [[ $action == TEST && -n $TARGET_TEST && $TARGET_TEST != $test_name ]]; then
continue
fi

if [[ $action == WITH ]]; then
echo $test_name $pubber_opts > $AUGMENT_OPTS
DEVICE_ID=$test_name
echo $pubber_opts > $AUGMENT_OPTS
echo Executing itemized tests as $DEVICE_ID with $pubber_opts
continue
elif [[ -z $action || $action =~ ^# ]]; then
continue
Expand All @@ -57,19 +62,17 @@ while read -u 7 action test_name pubber_opts; do
false
fi

((test_index++)) || true
test_marker=$(printf %02d $test_index)
if [[ -z $MATRIX_SHARD_COUNT || $((test_index % MATRIX_SHARD_COUNT)) == $MATRIX_SHARD_INDEX ]]; then
echo Executing shard test index $test_index
echo Executing $test_name shard test index $test_marker
else
echo Skipping non-shard test index $test_index
echo Skipping $test_name non-shard test index $test_marker
continue
fi

echo itemized test $test_name $pubber_opts [$(< $AUGMENT_OPTS)]

# Clean out the persistant data store to ensure a clean state each time.
rm -rf sites/udmi_site_model/out/devices/AHU-1/persistent_data.json
rm -rf sites/udmi_site_model/out/devices/AHU-1/persistent_data.json $SITE_PATH/out

echo bin/reset_config $SITE_PATH $PROJECT_ID $DEVICE_ID
bin/reset_config $SITE_PATH $PROJECT_ID $DEVICE_ID
Expand Down Expand Up @@ -102,29 +105,26 @@ while read -u 7 action test_name pubber_opts; do
kill $(ps ax | fgrep pubber | fgrep java | awk '{print $1}') || true

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

mv $PUBBER_LOG $PUBBER_LOG-$test_marker
mv $SEQUENCER_OUT $SEQUENCER_OUT-$test_marker
mv $SEQUENCER_LOG $SEQUENCER_LOG-$test_marker

echo =========== $test_name >> $SCHEMA_OUT
cat out/schema.out >> $SCHEMA_OUT
mv out/schema.out $SCHEMA_OUT-$test_marker
rm -rf $SITE_PATH/out-$test_marker
mv $SITE_PATH/out $SITE_PATH/out-$test_marker

sleep 2
if [[ -s $SCHEMA_OUT ]]; then
cat $SCHEMA_OUT | sed -e "s/^/$test_name /" >> $SCHEMA_ITEMIZED
else
echo $test_name >> $SCHEMA_ITEMIZED
fi

done 7< $INPUT_FILE

if [[ -z $TARGET_TEST && -z $MATRIX_SHARD_COUNT ]]; then
echo Comparing diff $RESULTS_OUT $GOLDEN_FILE
diff -bu $RESULTS_OUT $GOLDEN_FILE

echo Comparing diff $SCHEMA_OUT $GOLDEN_SCHEMAS
uniq < $SCHEMA_OUT | sponge $SCHEMA_OUT
diff -bu $SCHEMA_OUT $GOLDEN_SCHEMAS
bin/test_itemcheck
else
echo Archiving $SITE_PATH/out to $SITE_PATH/out-itm
rm -rf $SITE_PATH/out-itm/
mv $SITE_PATH/out/ $SITE_PATH/out-itm/
echo Skipping item checks
fi

echo Done with itemized test run.
13 changes: 10 additions & 3 deletions bin/test_sequcheck
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
suffix=$1
shift || true

UDMI_ROOT=$(dirname $0)/..
cd $UDMI_ROOT

source $UDMI_ROOT/etc/shell_common.sh

if [[ -z $suffix ]]; then
bin/sequencer_cache -t
fi
Expand All @@ -24,9 +29,11 @@ diff -u out/generated.tmp docs/specs/sequences/generated.md || (
false
)

SAMPLE_TEST_ROW="| discovery.scan | single_scan | alpha | pass | Sequence complete |"
echo Checking for expected entry in generated results.md
fgrep "$SAMPLE_TEST_ROW" sites/udmi_site_model/out/devices/AHU-1/results.md
SAMPLE_TEST_ROW="| system | system_min_loglevel | alpha | pass | Sequence complete |"
target=sites/udmi_site_model/out/devices/AHU-1/results.md
echo Checking for expected entry in $target:
echo "$SAMPLE_TEST_ROW"
fgrep "$SAMPLE_TEST_ROW" $target || fail expected line not found

echo Checking for duplication in out/sequencer.out and etc/sequencer_planning.txt
bin/test_sequencer_plan
Expand Down
37 changes: 17 additions & 20 deletions bin/test_sequencer
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ echo "export MATRIX_SHARD_INDEX=$MATRIX_SHARD_INDEX"

site_path=sites/udmi_site_model
device_id=AHU-1
output_file=$site_path/out/sequencer_$device_id.json
device_out_base=$site_path/out/devices/$device_id
test_out_base=$device_out_base/tests
site_out=$site_path/out
output_file=$site_out/sequencer_$device_id.json
device_out_base=$site_out/devices/$device_id
tests_out_base=$device_out_base/tests

if [[ -n $clean_cache ]]; then
echo Cleaning out/ $test_out_base/
rm -rf out/ $test_out_base/
rm -rf out/ $site_path/out-seq $site_out
fi

mkdir -p $test_out_base out/
mkdir -p out/ $tests_out_base/

serial_no=sequencer-$RANDOM
echo Using pubber with serial $serial_no
Expand All @@ -84,7 +84,7 @@ bin/clone_model # Clone, and check that version is correct.
bin/reset_config $site_path $project_id $device_id

# Clean out the persistant data store to ensure a clean state each time.
rm -rf $site_path/out/devices/${device_id}/persistent_data.json
rm -rf $site_out/devices/${device_id}/persistent_data.json

pubber/bin/build

Expand Down Expand Up @@ -128,13 +128,14 @@ else
fi

echo Combining partial-run output files...
ls -l out/schema.out out/sequencer.log

cat out/schema.out >> out/schema.out.combined
cat out/sequencer.log >> out/sequencer.log.combined
cat out/sequencer.out >> out/sequencer.out.combined
echo Combined to:
ls -l out/schema.out.combined out/sequencer.log.combined || true
ls -l out
files=$(cd out; ls -1 *.out *.log)
echo Merging $files
for file in $files; do
cat out/$file >> out/$file.combined
cp out/$file.combined out/$file
done
ls -l out

if [[ -n $out_check ]]; then
if [[ -n $clean_cache ]]; then
Expand All @@ -144,12 +145,8 @@ if [[ -n $out_check ]]; then

bin/test_sequcheck $suffix
else
if [[ -n $clean_cache ]]; then
echo Cleaning sequencer out archive...
rm -rf $site_path/out-seq
fi

echo Archiving $site_path/out to $site_path/out-seq
echo Preparing stuff for shard reconcilliation
mkdir -p $site_path/out-seq
rsync -ah $site_path/out/ $site_path/out-seq/
rm -rf $site_path/out
fi
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/com/google/udmi/util/Common.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.google.udmi.util;

import static com.google.udmi.util.GeneralUtils.stackTraceString;
import static java.util.Optional.ofNullable;

import com.google.common.base.Function;
import com.google.common.base.Joiner;
Expand Down Expand Up @@ -38,7 +37,8 @@ public abstract class Common {
public static final String SUBFOLDER_PROPERTY_KEY = "subFolder";
public static final String PROJECT_ID_PROPERTY_KEY = "projectId";
public static final String REGISTRY_ID_PROPERTY_KEY = "deviceRegistryId";
public static final String DEVICE_ID_PROPERTY_KEY = "deviceId";
public static final String DEVICE_ID_KEY = "deviceId";
public static final String GATEWAY_ID_KEY = "gatewayId";
public static final String MESSAGE_SOURCE_PROPERTY_KEY = "source";
public static final String NO_SITE = "--";
public static final String GCP_REFLECT_KEY_PKCS8 = "reflector/rsa_private.pkcs8";
Expand Down
Loading
Loading