Added test for meter extras in config file.

pull/331/head
Fredrik Öhrström 2021-08-27 08:45:37 +02:00
rodzic 301f7bd3f7
commit 718cb8fe1b
5 zmienionych plików z 42 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,5 @@
# Apator where offset=29 must be set.
telegram=|3E4401061405410305077A190030852F2F|0F86B4B89529020040C6C1B4F0F3F341555942FA701000F00101000010BC780000FFFFFFFFFFFFFFFFFFFFFF2483|
{"media":"water","meter":"apator162","name":"Water","id":"03410514","total_m3":30.908,"timestamp":"1111-11-11T11:11:11Z"}
|MyTapWaterOverride;03410514;30.908000;1111-11-11 11:11.11

Wyświetl plik

@ -108,6 +108,9 @@ if [ "$?" != "0" ]; then RC="1"; fi
./tests/test_log_timestamps.sh $PROG
if [ "$?" != "0" ]; then RC="1"; fi
./tests/test_meter_extras.sh $PROG
if [ "$?" != "0" ]; then RC="1"; fi
if [ -x ../additional_tests.sh ]
then
(cd ..; ./additional_tests.sh $PROG)

Wyświetl plik

@ -0,0 +1,3 @@
loglevel=normal
logtelegrams=false
format=json

Wyświetl plik

@ -0,0 +1,4 @@
name=Water
driver=apator162(offset=29)
id=03410514
key=

Wyświetl plik

@ -0,0 +1,27 @@
#!/bin/sh
PROG="$1"
TEST=testoutput
mkdir -p $TEST
TESTNAME="Test meter driver extra settings"
TESTRESULT="ERROR"
cat simulations/simulation_extras.txt | grep '^{' > $TEST/test_expected.txt
$PROG --useconfig=tests/config8 --device=simulations/simulation_extras.txt 2> $TEST/test_stderr.txt > $TEST/test_output.txt
if [ "$?" = "0" ]
then
cat $TEST/test_output.txt | sed 's/"timestamp":"....-..-..T..:..:..Z"/"timestamp":"1111-11-11T11:11:11Z"/' > $TEST/test_responses.txt
diff $TEST/test_expected.txt $TEST/test_responses.txt
if [ "$?" = "0" ]
then
echo OK: $TESTNAME
TESTRESULT="OK"
fi
else
echo "wmbusmeters returned error code: $?"
cat $TEST/test_output.txt
cat $TEST/test_stderr.txt
fi