diff --git a/tests/metrics_sample_aava.json b/tests/metrics_sample_aava.json index 34dcc52..d37ec87 100644 --- a/tests/metrics_sample_aava.json +++ b/tests/metrics_sample_aava.json @@ -180,6 +180,18 @@ "status" : "sailing", "metrics" : {"navigation.log": 17441766, "navigation.trip.log": 80747, "navigation.headingTrue": 3.5972, "navigation.gnss.satellites": 10, "environment.depth.belowKeel": 20.948999999999998, "navigation.magneticVariation": 0.1414, "navigation.speedThroughWater": 3.47, "environment.water.temperature": 313.15, "electrical.batteries.1.current": 192.4, "electrical.batteries.1.voltage": 14.56, "navigation.gnss.antennaAltitude": 0.39, "network.n2k.ngt-1.130356.errorID": 0, "network.n2k.ngt-1.130356.modelID": 14, "environment.depth.belowTransducer": 20.95, "electrical.batteries.1.temperature": 299.82, "environment.depth.transducerToKeel": -0.001, "navigation.gnss.horizontalDilution": 0.8, "network.n2k.ngt-1.130356.ch1.rxLoad": 4, "network.n2k.ngt-1.130356.ch1.txLoad": 0, "network.n2k.ngt-1.130356.ch2.rxLoad": 0, "network.n2k.ngt-1.130356.ch2.txLoad": 64, "network.n2k.ngt-1.130356.ch1.deleted": 0, "network.n2k.ngt-1.130356.ch2.deleted": 0, "network.n2k.ngt-1.130356.ch2Bandwidth": 3, "network.n2k.ngt-1.130356.ch1.bandwidth": 2, "network.n2k.ngt-1.130356.ch1.rxDropped": 0, "network.n2k.ngt-1.130356.ch2.rxDropped": 0, "network.n2k.ngt-1.130356.ch1.rxFiltered": 0, "network.n2k.ngt-1.130356.ch2.rxFiltered": 0, "network.n2k.ngt-1.130356.ch1.rxBandwidth": 4, "network.n2k.ngt-1.130356.ch1.txBandwidth": 0, "network.n2k.ngt-1.130356.ch2.rxBandwidth": 0, "network.n2k.ngt-1.130356.ch2.txBandwidth": 10, "network.n2k.ngt-1.130356.uniChannelCount": 2, "network.n2k.ngt-1.130356.indiChannelCount": 2, "network.n2k.ngt-1.130356.ch1.BufferLoading": 0, "network.n2k.ngt-1.130356.ch2.bufferLoading": 0, "network.n2k.ngt-1.130356.ch1.PointerLoading": 0, "network.n2k.ngt-1.130356.ch2.pointerLoading": 0} }, + { + "time" : "2022-07-31T11:41:28.561Z", + "client_id" : "vessels.urn:mrn:imo:mmsi:987654321", + "latitude" : 59.7163052, + "longitude" : 25.7325741, + "speedoverground" : 9.5, + "courseovergroundtrue" : 198.8, + "windspeedapparent" : 18.0, + "anglespeedapparent" : 41.0, + "status" : "sailing", + "metrics" : {"navigation.log": 17441766, "navigation.trip.log": 80747, "navigation.headingTrue": 3.5972, "navigation.gnss.satellites": 10, "environment.depth.belowKeel": 20.948999999999998, "navigation.magneticVariation": 0.1414, "navigation.speedThroughWater": 3.47, "environment.water.temperature": 313.15, "electrical.batteries.1.current": 192.4, "electrical.batteries.1.voltage": 14.56, "navigation.gnss.antennaAltitude": 0.39, "network.n2k.ngt-1.130356.errorID": 0, "network.n2k.ngt-1.130356.modelID": 14, "environment.depth.belowTransducer": 20.95, "electrical.batteries.1.temperature": 299.82, "environment.depth.transducerToKeel": -0.001, "navigation.gnss.horizontalDilution": 0.8, "network.n2k.ngt-1.130356.ch1.rxLoad": 4, "network.n2k.ngt-1.130356.ch1.txLoad": 0, "network.n2k.ngt-1.130356.ch2.rxLoad": 0, "network.n2k.ngt-1.130356.ch2.txLoad": 64, "network.n2k.ngt-1.130356.ch1.deleted": 0, "network.n2k.ngt-1.130356.ch2.deleted": 0, "network.n2k.ngt-1.130356.ch2Bandwidth": 3, "network.n2k.ngt-1.130356.ch1.bandwidth": 2, "network.n2k.ngt-1.130356.ch1.rxDropped": 0, "network.n2k.ngt-1.130356.ch2.rxDropped": 0, "network.n2k.ngt-1.130356.ch1.rxFiltered": 0, "network.n2k.ngt-1.130356.ch2.rxFiltered": 0, "network.n2k.ngt-1.130356.ch1.rxBandwidth": 4, "network.n2k.ngt-1.130356.ch1.txBandwidth": 0, "network.n2k.ngt-1.130356.ch2.rxBandwidth": 0, "network.n2k.ngt-1.130356.ch2.txBandwidth": 10, "network.n2k.ngt-1.130356.uniChannelCount": 2, "network.n2k.ngt-1.130356.indiChannelCount": 2, "network.n2k.ngt-1.130356.ch1.BufferLoading": 0, "network.n2k.ngt-1.130356.ch2.bufferLoading": 0, "network.n2k.ngt-1.130356.ch1.PointerLoading": 0, "network.n2k.ngt-1.130356.ch2.pointerLoading": 0} + }, { "time" : "2022-07-31T11:42:28.569Z", "client_id" : "vessels.urn:mrn:imo:mmsi:987654321", diff --git a/tests/sql/cron_post_jobs.sql b/tests/sql/cron_post_jobs.sql index 0690976..6a91608 100644 --- a/tests/sql/cron_post_jobs.sql +++ b/tests/sql/cron_post_jobs.sql @@ -69,6 +69,12 @@ SELECT extra FROM api.logbook l WHERE id = 1 AND vessel_id = current_setting('ve SELECT api.update_logbook_observations_fn(1, '{"tags": ["tag_name"]}'::TEXT); SELECT extra FROM api.logbook l WHERE id = 1 AND vessel_id = current_setting('vessel.id', false); +\echo 'Check numbers of geojson properties' +SELECT jsonb_object_keys(jsonb_path_query(track_geojson, '$.features[0].properties')) + FROM api.logbook where id = 1 AND vessel_id = current_setting('vessel.id', false); +SELECT jsonb_object_keys(jsonb_path_query(track_geojson, '$.features[1].properties')) + FROM api.logbook where id = 1 AND vessel_id = current_setting('vessel.id', false); + -- Check export --\echo 'check logbook export fn' --SELECT api.export_logbook_geojson_fn(1); diff --git a/tests/sql/cron_post_jobs.sql.output b/tests/sql/cron_post_jobs.sql.output index f53289b..a1a5086 100644 --- a/tests/sql/cron_post_jobs.sql.output +++ b/tests/sql/cron_post_jobs.sql.output @@ -73,14 +73,14 @@ SELECT 1 -[ RECORD 1 ]+---------- name | "kapla" count | 4 -max_speed | 7.1 -max_distance | 8.8968 +max_speed | 9.5 +max_distance | 68.8677 max_duration | "PT1H11M" ?column? | 3 -?column? | 30.1154 -?column? | "PT2H43M" +?column? | 90.6030 +?column? | "PT2H44M" ?column? | 44.2 -?column? | 2 +?column? | 3 ?column? | 4 ?column? | 4 first_date | t @@ -110,3 +110,54 @@ update_logbook_observations_fn | t -[ RECORD 1 ]-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- extra | {"tags": ["tag_name"], "metrics": {"propulsion.main.runTime": "PT10S"}, "observations": {"seaState": -1, "visibility": -1, "cloudCoverage": 1}, "avg_wind_speed": 14.549999999999999} +Check numbers of geojson properties +-[ RECORD 1 ]-----+----------------- +jsonb_object_keys | id +-[ RECORD 2 ]-----+----------------- +jsonb_object_keys | name +-[ RECORD 3 ]-----+----------------- +jsonb_object_keys | notes +-[ RECORD 4 ]-----+----------------- +jsonb_object_keys | _to_time +-[ RECORD 5 ]-----+----------------- +jsonb_object_keys | distance +-[ RECORD 6 ]-----+----------------- +jsonb_object_keys | duration +-[ RECORD 7 ]-----+----------------- +jsonb_object_keys | avg_speed +-[ RECORD 8 ]-----+----------------- +jsonb_object_keys | max_speed +-[ RECORD 9 ]-----+----------------- +jsonb_object_keys | _from_time +-[ RECORD 10 ]----+----------------- +jsonb_object_keys | _to_moorage_id +-[ RECORD 11 ]----+----------------- +jsonb_object_keys | avg_wind_speed +-[ RECORD 12 ]----+----------------- +jsonb_object_keys | max_wind_speed +-[ RECORD 13 ]----+----------------- +jsonb_object_keys | _from_moorage_id + +-[ RECORD 1 ]-----+--------------------- +jsonb_object_keys | time +-[ RECORD 2 ]-----+--------------------- +jsonb_object_keys | trip +-[ RECORD 3 ]-----+--------------------- +jsonb_object_keys | notes +-[ RECORD 4 ]-----+--------------------- +jsonb_object_keys | status +-[ RECORD 5 ]-----+--------------------- +jsonb_object_keys | latitude +-[ RECORD 6 ]-----+--------------------- +jsonb_object_keys | longitude +-[ RECORD 7 ]-----+--------------------- +jsonb_object_keys | truewindspeed +-[ RECORD 8 ]-----+--------------------- +jsonb_object_keys | speedoverground +-[ RECORD 9 ]-----+--------------------- +jsonb_object_keys | truewinddirection +-[ RECORD 10 ]----+--------------------- +jsonb_object_keys | windspeedapparent +-[ RECORD 11 ]----+--------------------- +jsonb_object_keys | courseovergroundtrue + diff --git a/tests/sql/cron_run_jobs.sql.output b/tests/sql/cron_run_jobs.sql.output index 61a3318..aedb12b 100644 --- a/tests/sql/cron_run_jobs.sql.output +++ b/tests/sql/cron_run_jobs.sql.output @@ -17,5 +17,5 @@ any_pending_jobs | 2 Check the number of metrics entries -[ RECORD 1 ]-+---- -metrics_count | 172 +metrics_count | 173 diff --git a/tests/sql/monitoring.sql.output b/tests/sql/monitoring.sql.output index 5950ab3..6eca2f8 100644 --- a/tests/sql/monitoring.sql.output +++ b/tests/sql/monitoring.sql.output @@ -22,15 +22,15 @@ count | 21 Test monitoring_view3 for user -[ RECORD 1 ] -count | 3736 +count | 3775 Test monitoring_voltage for user -[ RECORD 1 ] -count | 47 +count | 48 Test monitoring_temperatures for user -[ RECORD 1 ] -count | 120 +count | 121 Test monitoring_humidity for user -[ RECORD 1 ] diff --git a/tests/sql/qgis.sql.output b/tests/sql/qgis.sql.output index 3c18c29..f7de191 100644 --- a/tests/sql/qgis.sql.output +++ b/tests/sql/qgis.sql.output @@ -11,35 +11,35 @@ Get BBOX Extent from SQL query for a log: "^/log_(w+)_(d+).png$" qgis_bbox_py_fn | 2556155.0636042403,8365608,2660086.9363957597,8420076 -[ RECORD 1 ]---+---------------------------------------------------- -qgis_bbox_py_fn | 2749398.035335689,8334944,2756917.964664311,8338885 +qgis_bbox_py_fn | 2745681,8303937.662962963,2871529,8369891.337037037 Get BBOX Extent from SQL query for a log as line: "^/log_(w+)_(d+)_line.png$" -[ RECORD 1 ]---+------------------------------------------------------------------------- qgis_bbox_py_fn | 2570800.6277114027,8368634.173700442,2645441.4677270483,8417049.85371059 --[ RECORD 1 ]---+-------------------------------------------------------------------------- -qgis_bbox_py_fn | 2750457.4431765806,8335162.530580978,2755858.0759322727,8338665.643719805 +-[ RECORD 1 ]---+----------------------------------------------------------------------- +qgis_bbox_py_fn | 2752672.6236475753,8300633.73408079,2864537.04561218,8373194.440219993 Get BBOX Extent from SQL query for all logs by vessel_id: "^/logs_(w+)_(d+).png$" -[ RECORD 1 ]---+------------------------------------------------------ qgis_bbox_py_fn | 2556155.0636042403,8365608,2660086.9363957597,8420076 -[ RECORD 1 ]---+------------------------------------------------------ -qgis_bbox_py_fn | -2006284.4558303887,4864146,5013530.455830389,8543049 +qgis_bbox_py_fn | -1950837.4558303887,4864146,5068977.455830389,8543049 Get BBOX Extent from SQL query for a trip by vessel_id: "^/trip_(w+)_(d+)_(d+).png$" -[ RECORD 1 ]---+------------------------------------- qgis_bbox_py_fn | 2595383,4787988.0,2620859,11997696.0 -[ RECORD 1 ]---+--------------------------------------- -qgis_bbox_py_fn | 97351,-192283890.5,2909895,205691085.5 +qgis_bbox_py_fn | 90420,-201110377.5,3027720,214517572.5 Get BBOX Extent from SQL query for a trip by vessel_id: "^/trip_((w+)_(d+)_(d+)).png$" -[ RECORD 1 ]--------+------------------------------------------------------ qgis_bbox_trip_py_fn | 2556155.0636042403,8365608,2660086.9363957597,8420076 -[ RECORD 1 ]--------+------------------------------------------------------ -qgis_bbox_trip_py_fn | -2006284.4558303887,4864146,5013530.455830389,8543049 +qgis_bbox_trip_py_fn | -1950837.4558303887,4864146,5068977.455830389,8543049 -[ RECORD 1 ] count | 3