kopia lustrzana https://github.com/weetmuts/wmbusmeters
Preparing tests for sorted json output keys.
rodzic
0eb90f697c
commit
85a4857124
|
@ -9,9 +9,10 @@ TESTNAME="Test that normal meterfiles are written"
|
||||||
TESTRESULT="ERROR"
|
TESTRESULT="ERROR"
|
||||||
|
|
||||||
rm -f /tmp/MyTapWater
|
rm -f /tmp/MyTapWater
|
||||||
cat simulations/simulation_c1.txt | grep '^{' | grep 76348799 | tail -n 1 > $TEST/test_expected.txt
|
cat simulations/simulation_c1.txt | grep '^{' | grep 76348799 | tail -n 1 | jq --sort-keys . > $TEST/test_expected.txt
|
||||||
$PROG --meterfiles --format=json simulations/simulation_c1.txt MyTapWater multical21 76348799 "" > /dev/null 2> $TEST/test_stderr.txt
|
$PROG --meterfiles --format=json simulations/simulation_c1.txt MyTapWater multical21 76348799 "" \
|
||||||
cat /tmp/MyTapWater | sed 's/"timestamp":"....-..-..T..:..:..Z"/"timestamp":"1111-11-11T11:11:11Z"/' > $TEST/test_response.txt
|
2> $TEST/test_stderr.txt
|
||||||
|
cat /tmp/MyTapWater | jq --sort-keys . | sed 's/"timestamp": "....-..-..T..:..:..Z"/"timestamp": "1111-11-11T11:11:11Z"/' > $TEST/test_response.txt
|
||||||
diff $TEST/test_expected.txt $TEST/test_response.txt
|
diff $TEST/test_expected.txt $TEST/test_response.txt
|
||||||
if [ "$?" = "0" ]
|
if [ "$?" = "0" ]
|
||||||
then
|
then
|
||||||
|
@ -27,9 +28,11 @@ TESTRESULT="ERROR"
|
||||||
|
|
||||||
rm -rf /tmp/testmeters
|
rm -rf /tmp/testmeters
|
||||||
mkdir /tmp/testmeters
|
mkdir /tmp/testmeters
|
||||||
cat simulations/simulation_c1.txt | grep '^{' | grep 76348799 | tail -n 1 > $TEST/test_expected.txt
|
cat simulations/simulation_c1.txt | grep '^{' | grep 76348799 | tail -n 1 | jq --sort-keys . > $TEST/test_expected.txt
|
||||||
$PROG --meterfiles=/tmp/testmeters --meterfilesnaming=name-id --format=json simulations/simulation_c1.txt MyTapWater multical21 76348799 "" > /dev/null 2> $TEST/test_stderr.txt
|
$PROG --meterfiles=/tmp/testmeters --meterfilesnaming=name-id --format=json \
|
||||||
cat /tmp/testmeters/MyTapWater-76348799 | sed 's/"timestamp":"....-..-..T..:..:..Z"/"timestamp":"1111-11-11T11:11:11Z"/' > $TEST/test_response.txt
|
simulations/simulation_c1.txt MyTapWater multical21 76348799 "" \
|
||||||
|
> /dev/null 2> $TEST/test_stderr.txt
|
||||||
|
cat /tmp/testmeters/MyTapWater-76348799 | jq --sort-keys . | sed 's/"timestamp": "....-..-..T..:..:..Z"/"timestamp": "1111-11-11T11:11:11Z"/' > $TEST/test_response.txt
|
||||||
diff $TEST/test_expected.txt $TEST/test_response.txt
|
diff $TEST/test_expected.txt $TEST/test_response.txt
|
||||||
if [ "$?" = "0" ]
|
if [ "$?" = "0" ]
|
||||||
then
|
then
|
||||||
|
@ -45,9 +48,11 @@ TESTRESULT="ERROR"
|
||||||
|
|
||||||
rm -rf /tmp/testmeters
|
rm -rf /tmp/testmeters
|
||||||
mkdir /tmp/testmeters
|
mkdir /tmp/testmeters
|
||||||
cat simulations/simulation_c1.txt | grep '^{' | grep 76348799 | tail -n 1 > $TEST/test_expected.txt
|
cat simulations/simulation_c1.txt | grep '^{' | grep 76348799 | tail -n 1 | jq --sort-keys . > $TEST/test_expected.txt
|
||||||
$PROG --meterfiles=/tmp/testmeters --meterfilesnaming=id --format=json simulations/simulation_c1.txt MyTapWater multical21 76348799 "" 2> $TEST/test_stderr.txt
|
$PROG --meterfiles=/tmp/testmeters --meterfilesnaming=id --format=json \
|
||||||
cat /tmp/testmeters/76348799 | sed 's/"timestamp":"....-..-..T..:..:..Z"/"timestamp":"1111-11-11T11:11:11Z"/' > $TEST/test_response.txt
|
simulations/simulation_c1.txt MyTapWater multical21 76348799 "" \
|
||||||
|
2> $TEST/test_stderr.txt
|
||||||
|
cat /tmp/testmeters/76348799 | jq --sort-keys . | sed 's/"timestamp": "....-..-..T..:..:..Z"/"timestamp": "1111-11-11T11:11:11Z"/' > $TEST/test_response.txt
|
||||||
diff $TEST/test_expected.txt $TEST/test_response.txt
|
diff $TEST/test_expected.txt $TEST/test_response.txt
|
||||||
if [ "$?" = "0" ]
|
if [ "$?" = "0" ]
|
||||||
then
|
then
|
||||||
|
@ -64,9 +69,11 @@ TESTRESULT="ERROR"
|
||||||
|
|
||||||
rm -rf /tmp/testmeters
|
rm -rf /tmp/testmeters
|
||||||
mkdir /tmp/testmeters
|
mkdir /tmp/testmeters
|
||||||
cat simulations/simulation_c1.txt | grep '^{' | grep 76348799 | tail -n 1 > $TEST/test_expected.txt
|
cat simulations/simulation_c1.txt | grep '^{' | grep 76348799 | tail -n 1 | jq --sort-keys . > $TEST/test_expected.txt
|
||||||
$PROG --meterfiles=/tmp/testmeters --meterfilesnaming=id --meterfilestimestamp=day --format=json simulations/simulation_c1.txt MyTapWater multical21 76348799 "" 2> $TEST/test_stderr.txt
|
$PROG --meterfiles=/tmp/testmeters --meterfilesnaming=id --meterfilestimestamp=day --format=json \
|
||||||
cat /tmp/testmeters/76348799_$(date +%Y-%m-%d) | sed 's/"timestamp":"....-..-..T..:..:..Z"/"timestamp":"1111-11-11T11:11:11Z"/' > $TEST/test_response.txt
|
simulations/simulation_c1.txt MyTapWater multical21 76348799 "" \
|
||||||
|
2> $TEST/test_stderr.txt
|
||||||
|
cat /tmp/testmeters/76348799_$(date +%Y-%m-%d) | jq --sort-keys . | sed 's/"timestamp": "....-..-..T..:..:..Z"/"timestamp": "1111-11-11T11:11:11Z"/' > $TEST/test_response.txt
|
||||||
diff $TEST/test_expected.txt $TEST/test_response.txt
|
diff $TEST/test_expected.txt $TEST/test_response.txt
|
||||||
if [ "$?" = "0" ]
|
if [ "$?" = "0" ]
|
||||||
then
|
then
|
||||||
|
@ -79,9 +86,11 @@ if [ "$TESTRESULT" = "ERROR" ]; then echo ERROR: $TESTNAME; exit 1; fi
|
||||||
|
|
||||||
rm -rf /tmp/testmeters
|
rm -rf /tmp/testmeters
|
||||||
mkdir /tmp/testmeters
|
mkdir /tmp/testmeters
|
||||||
cat simulations/simulation_c1.txt | grep '^{' | grep 76348799 | tail -n 1 > $TEST/test_expected.txt
|
cat simulations/simulation_c1.txt | grep '^{' | grep 76348799 | tail -n 1 | jq --sort-keys . > $TEST/test_expected.txt
|
||||||
$PROG --meterfiles=/tmp/testmeters --meterfilesnaming=id --meterfilestimestamp=minute --format=json simulations/simulation_c1.txt MyTapWater multical21 76348799 "" 2> $TEST/test_stderr.txt
|
$PROG --meterfiles=/tmp/testmeters --meterfilesnaming=id --meterfilestimestamp=minute --format=json \
|
||||||
cat /tmp/testmeters/76348799_$(date +%Y-%m-%d_%H:%M) | sed 's/"timestamp":"....-..-..T..:..:..Z"/"timestamp":"1111-11-11T11:11:11Z"/' > $TEST/test_response.txt
|
simulations/simulation_c1.txt MyTapWater multical21 76348799 "" \
|
||||||
|
2> $TEST/test_stderr.txt
|
||||||
|
cat /tmp/testmeters/76348799_$(date +%Y-%m-%d_%H:%M) | jq --sort-keys . | sed 's/"timestamp": "....-..-..T..:..:..Z"/"timestamp": "1111-11-11T11:11:11Z"/' > $TEST/test_response.txt
|
||||||
diff $TEST/test_expected.txt $TEST/test_response.txt
|
diff $TEST/test_expected.txt $TEST/test_response.txt
|
||||||
if [ "$?" = "0" ]
|
if [ "$?" = "0" ]
|
||||||
then
|
then
|
||||||
|
|
Ładowanie…
Reference in New Issue