diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 5e846fc83d1a..9a7f6807ffd5 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -253,6 +253,7 @@ in { etebase-server = handleTest ./etebase-server.nix {}; etesync-dav = handleTest ./etesync-dav.nix {}; evcc = handleTest ./evcc.nix {}; + fakeroute = handleTest ./fakeroute.nix {}; fancontrol = handleTest ./fancontrol.nix {}; fcitx5 = handleTest ./fcitx5 {}; fenics = handleTest ./fenics.nix {}; diff --git a/nixos/tests/fakeroute.nix b/nixos/tests/fakeroute.nix new file mode 100644 index 000000000000..37b174524ab8 --- /dev/null +++ b/nixos/tests/fakeroute.nix @@ -0,0 +1,22 @@ +import ./make-test-python.nix ({ lib, pkgs, ...} : { + name = "fakeroute"; + meta.maintainers = with lib.maintainers; [ rnhmjoj ]; + + nodes.machine = { ... }: { + imports = [ ../modules/profiles/minimal.nix ]; + services.fakeroute.enable = true; + services.fakeroute.route = + [ "216.102.187.130" "4.0.1.122" + "198.116.142.34" "63.199.8.242" + ]; + environment.systemPackages = [ pkgs.traceroute ]; + }; + + testScript = + '' + start_all() + machine.wait_for_unit("fakeroute.service") + machine.succeed("traceroute 127.0.0.1 | grep -q 216.102.187.130") + ''; +}) + diff --git a/pkgs/tools/networking/fakeroute/default.nix b/pkgs/tools/networking/fakeroute/default.nix index 80753112a31e..fc07b1d9f66c 100644 --- a/pkgs/tools/networking/fakeroute/default.nix +++ b/pkgs/tools/networking/fakeroute/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl }: +{ lib, stdenv, fetchurl, nixosTests }: stdenv.mkDerivation rec { pname = "fakeroute"; @@ -9,6 +9,8 @@ stdenv.mkDerivation rec { hash = "sha256-DoXGJm8vOlAD6ZuvVAt6bkgfahc8WgyYIXCrgqzfiWg="; }; + passthru.tests.fakeroute = nixosTests.fakeroute; + meta = with lib; { description = '' Make your machine appears to be anywhere on the internet in a traceroute