From 58206c8919d50fce92aa2dd09046e5695de87ddb Mon Sep 17 00:00:00 2001 From: Diogo Correia Date: Tue, 7 Apr 2026 18:59:28 +0100 Subject: [PATCH] nixos/tests/dawarich: fix points being flagged as anomalies Due to a change upstream [1], points with velocity over 1000 km/h are flagged as anomalies and do not show up in the /points endpoint. This results in an assertion failure. To fix this, the dummy data file that was in use has been replaced with custom data that has spaced out timestamps, which avoids the points being flagged as anomalies. [1]: https://github.com/Freika/dawarich/commit/95ea3ed962c99b3790527655d512993b28270018 --- nixos/tests/web-apps/dawarich.nix | 43 +++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/nixos/tests/web-apps/dawarich.nix b/nixos/tests/web-apps/dawarich.nix index 2bc7679c9853..37451a87913b 100644 --- a/nixos/tests/web-apps/dawarich.nix +++ b/nixos/tests/web-apps/dawarich.nix @@ -3,17 +3,50 @@ name = "dawarich-nixos"; nodes.machine = - { pkgs, ... }: + { lib, pkgs, ... }: { services.dawarich = { enable = true; localDomain = "localhost"; }; - environment.etc.geojson.source = pkgs.fetchurl { - url = "https://github.com/Freika/dawarich/raw/8c24764aa56a084e980e21bc2ffd13a72fd611db/spec/fixtures/files/geojson/export.json"; - hash = "sha256-qI00E5ixKTRJduAD+qB3JzvrpoJmC55llNtSiPVyxz4="; - }; + environment.etc.geojson.text = + let + # based on https://github.com/Freika/dawarich/raw/8c24764aa56a084e980e21bc2ffd13a72fd611db/spec/fixtures/files/geojson/export.json + # but with different timestamps to avoid points being flagged as anomalies + points = map (i: { + lat = i / 10.0; + lon = i / 10.0; + timestamp = 1609459200 + i * 1000; + }) (lib.range 1 10); + + mkGeoJsonPoint = + { + lat, + lon, + timestamp, + }: + { + type = "Feature"; + geometry = { + type = "Point"; + coordinates = [ + lon + lat + ]; + }; + properties = { + altitude = 1; + vertical_accuracy = 1; + accuracy = 1; + inherit timestamp; + }; + }; + in + builtins.toJSON { + type = "FeatureCollection"; + features = map mkGeoJsonPoint points; + }; }; testScript = ''