Skip to content

Commit

Permalink
nixos/tests/fakeroute: init
Browse files Browse the repository at this point in the history
(cherry picked from commit 1761cbc)
  • Loading branch information
rnhmjoj authored and github-actions[bot] committed Jun 20, 2023
1 parent c97a6a5 commit 4bbecb6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,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 {};
Expand Down
22 changes: 22 additions & 0 deletions nixos/tests/fakeroute.nix
Original file line number Diff line number Diff line change
@@ -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")
'';
})

4 changes: 3 additions & 1 deletion pkgs/tools/networking/fakeroute/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl }:
{ lib, stdenv, fetchurl, nixosTests }:

stdenv.mkDerivation rec {
pname = "fakeroute";
Expand All @@ -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
Expand Down

0 comments on commit 4bbecb6

Please sign in to comment.