Update tests to accomodate new json ordering of keys.

pull/1021/head
Fredrik Öhrström 2023-08-27 21:36:17 +02:00
rodzic e577c0b30c
commit 9084a0323f
3 zmienionych plików z 10 dodań i 10 usunięć

Wyświetl plik

@ -30,8 +30,8 @@ cat > $TEST/test_expected.txt <<EOF
EOF
cat > /tmp/wmbusmeters_telegram_expected <<EOF
METER =={"media":"cold water","meter":"multical21","name":"Water","id":"76348799","status":"DRY","total_m3":6.408,"target_m3":6.408,"flow_temperature_c":127,"external_temperature_c":19,"current_status":"DRY","time_dry":"22-31 days","time_reversed":"","time_leaking":"","time_bursting":"","timestamp":"1111-11-11T11:11:11Z"}==
METER =={"media":"cold water","meter":"multical21","name":"Water","id":"76348799","status":"DRY","total_m3":6.408,"target_m3":6.408,"flow_temperature_c":127,"external_temperature_c":19,"current_status":"DRY","time_dry":"22-31 days","time_reversed":"","time_leaking":"","time_bursting":"","timestamp":"1111-11-11T11:11:11Z"}==
METER =={"media":"cold water","meter":"multical21","name":"Water","id":"76348799","external_temperature_c":19,"flow_temperature_c":127,"target_m3":6.408,"total_m3":6.408,"current_status":"DRY","status":"DRY","time_bursting":"","time_dry":"22-31 days","time_leaking":"","time_reversed":"","timestamp":"1111-11-11T11:11:11Z"}==
METER =={"media":"cold water","meter":"multical21","name":"Water","id":"76348799","external_temperature_c":19,"flow_temperature_c":127,"target_m3":6.408,"total_m3":6.408,"current_status":"DRY","status":"DRY","time_bursting":"","time_dry":"22-31 days","time_leaking":"","time_reversed":"","timestamp":"1111-11-11T11:11:11Z"}==
EOF
cat > /tmp/wmbusmeters_alarm_expected <<EOF

Wyświetl plik

@ -16,10 +16,10 @@ mkdir -p $TEST
TESTNAME="Test config with oneshot"
TESTRESULT="ERROR"
cat simulations/serial_aes.msg | grep '^{' | tr -d '#' > $TEST/test_expected.txt
cat simulations/serial_aes.msg | grep '^{' | jq --sort-keys . | tr -d '#' > $TEST/test_expected.txt
cat simulations/serial_aes.msg | grep '^[CT]' | tr -d '#' > $TEST/test_input.txt
cat $TEST/test_input.txt | $PROG --useconfig=tests/config10 > $TEST/test_output.txt 2> $TEST/test_stderr.txt
cat $TEST/test_input.txt | $PROG --useconfig=tests/config10 2> $TEST/test_stderr.txt | jq --sort-keys . > $TEST/test_output.txt
if ! grep -q "(main) all meters have received at least one update, stopping." $TEST/test_stderr.txt
then
@ -28,7 +28,7 @@ then
exit 1
fi
cat $TEST/test_output.txt | sed 's/"timestamp":"....-..-..T..:..:..Z"/"timestamp":"1111-11-11T11:11:11Z"/' > $TEST/test_response.txt
cat $TEST/test_output.txt | sed 's/"timestamp": "....-..-..T..:..:..Z"/"timestamp": "1111-11-11T11:11:11Z"/' > $TEST/test_response.txt
diff $TEST/test_expected.txt $TEST/test_response.txt
if [ "$?" = "0" ]
then

Wyświetl plik

@ -16,10 +16,10 @@ mkdir -p $TEST
TESTNAME="Test config override with oneshot"
TESTRESULT="ERROR"
cat simulations/serial_aes.msg | grep '^{' | tr -d '#' > $TEST/test_expected.txt
cat simulations/serial_aes.msg | grep '^{' | jq --sort-keys . | tr -d '#' > $TEST/test_expected.txt
cat simulations/serial_aes.msg | grep '^[CT]' | tr -d '#' > $TEST/test_input.txt
cat $TEST/test_input.txt | $PROG --useconfig=tests/config9 --overridedevice=stdin:rtlwmbus --oneshot > $TEST/test_output.txt 2> $TEST/test_stderr.txt
cat $TEST/test_input.txt | $PROG --useconfig=tests/config9 --overridedevice=stdin:rtlwmbus --oneshot 2> $TEST/test_stderr.txt | jq --sort-keys . > $TEST/test_output.txt
if ! grep -q "(main) all meters have received at least one update, stopping." $TEST/test_stderr.txt
then
@ -28,7 +28,7 @@ then
exit 1
fi
cat $TEST/test_output.txt | sed 's/"timestamp":"....-..-..T..:..:..Z"/"timestamp":"1111-11-11T11:11:11Z"/' > $TEST/test_response.txt
cat $TEST/test_output.txt | sed 's/"timestamp": "....-..-..T..:..:..Z"/"timestamp": "1111-11-11T11:11:11Z"/' > $TEST/test_response.txt
diff $TEST/test_expected.txt $TEST/test_response.txt
if [ "$?" = "0" ]
then
@ -42,11 +42,11 @@ fi
TESTNAME="Test config override with exitafter"
TESTRESULT="ERROR"
cat simulations/serial_aes.msg | grep '^{' | tr -d '#' > $TEST/test_expected.txt
cat simulations/serial_aes.msg | grep '^{' | jq --sort-keys . | tr -d '#' > $TEST/test_expected.txt
cat simulations/serial_aes.msg | grep '^[CT]' | tr -d '#' > $TEST/test_input.txt
# Read from stdin
{ cat $TEST/test_input.txt ; sleep 4; } | $PROG --useconfig=tests/config9 --overridedevice=stdin:rtlwmbus --exitafter=1s > $TEST/test_output.txt 2> $TEST/test_stderr.txt
{ cat $TEST/test_input.txt ; sleep 4; } | $PROG --useconfig=tests/config9 --overridedevice=stdin:rtlwmbus --exitafter=1s 2> $TEST/test_stderr.txt | jq --sort-keys . > $TEST/test_output.txt
if ! grep -q "(serial) exit after " $TEST/test_stderr.txt
then