Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c9dbfad74550
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1a65fc104158
Choose a head ref
  • 16 commits
  • 15 files changed
  • 2 contributors

Commits on Nov 6, 2019

  1. nixos/trickster: port test to python

    Jan Hrnko committed Nov 6, 2019
    Copy the full SHA
    274fb7e View commit details
  2. nixos/yabar: port test to python

    Jan Hrnko committed Nov 6, 2019
    Copy the full SHA
    49914d7 View commit details
  3. nixos/zookeeper: port test to python

    Jan Hrnko committed Nov 6, 2019
    Copy the full SHA
    13febec View commit details
  4. nixos/upnp: port test to python

    Jan Hrnko committed Nov 6, 2019
    Copy the full SHA
    38b2e18 View commit details
  5. nixos/morty: port test to python

    Jan Hrnko committed Nov 6, 2019
    Copy the full SHA
    650ccb6 View commit details
  6. nixos/moodle: port test to python

    Jan Hrnko committed Nov 6, 2019
    Copy the full SHA
    6ea7ba4 View commit details
  7. nixos/xautolock: port test to python

    Jan Hrnko committed Nov 6, 2019
    Copy the full SHA
    8060e76 View commit details
  8. nixos/telegraf: port test to python

    Jan Hrnko committed Nov 6, 2019
    Copy the full SHA
    c0c0473 View commit details
  9. nixos/strongswan-swanctl: port test to python

    Jan Hrnko committed Nov 6, 2019
    Copy the full SHA
    1b6ca29 View commit details
  10. nixos/snapper: port test to python

    Jan Hrnko committed Nov 6, 2019
    Copy the full SHA
    3803aba View commit details
  11. nixos/radarr: port test to python

    Jan Hrnko committed Nov 6, 2019
    Copy the full SHA
    9ca60ed View commit details
  12. nixos/redis: port test to python

    Jan Hrnko committed Nov 6, 2019
    Copy the full SHA
    6868807 View commit details
  13. nixos/roundcube: port test to python

    Jan Hrnko committed Nov 6, 2019
    8
    Copy the full SHA
    71824d7 View commit details
  14. nixos/rss2email: port test to python

    Jan Hrnko committed Nov 6, 2019
    Copy the full SHA
    4ffdd43 View commit details
  15. nixos/signal-desktop: port test to python

    Jan Hrnko committed Nov 6, 2019
    Copy the full SHA
    8920cbc View commit details

Commits on Nov 7, 2019

  1. Merge pull request #72887 from 1000101/master

    Port tests to Python
    mmahut authored Nov 7, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1a65fc1 View commit details
8 changes: 4 additions & 4 deletions nixos/tests/moodle.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, lib, ... }: {
import ./make-test-python.nix ({ pkgs, lib, ... }: {
name = "moodle";
meta.maintainers = [ lib.maintainers.aanderse ];

@@ -15,8 +15,8 @@ import ./make-test.nix ({ pkgs, lib, ... }: {
};

testScript = ''
startAll;
$machine->waitForUnit('phpfpm-moodle.service');
$machine->succeed('curl http://localhost/') =~ /You are not logged in/ or die;
start_all()
machine.wait_for_unit("phpfpm-moodle.service")
machine.wait_until_succeeds("curl http://localhost/ | grep 'You are not logged in'")
'';
})
10 changes: 4 additions & 6 deletions nixos/tests/morty.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, ... }:
import ./make-test-python.nix ({ pkgs, ... }:

{
name = "morty";
@@ -22,11 +22,9 @@ import ./make-test.nix ({ pkgs, ... }:
testScript =
{ ... }:
''
$mortyProxyWithKey->waitForUnit("default.target");
$mortyProxyWithKey->waitForOpenPort(3001);
$mortyProxyWithKey->succeed("curl -L 127.0.0.1:3001 | grep MortyProxy");
mortyProxyWithKey.wait_for_unit("default.target")
mortyProxyWithKey.wait_for_open_port(3001)
mortyProxyWithKey.succeed("curl -L 127.0.0.1:3001 | grep MortyProxy")
'';

})
8 changes: 4 additions & 4 deletions nixos/tests/radarr.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ lib, ... }:
import ./make-test-python.nix ({ lib, ... }:

with lib;

@@ -11,8 +11,8 @@ with lib;
{ services.radarr.enable = true; };

testScript = ''
$machine->waitForUnit('radarr.service');
$machine->waitForOpenPort('7878');
$machine->succeed("curl --fail http://localhost:7878/");
machine.wait_for_unit("radarr.service")
machine.wait_for_open_port("7878")
machine.succeed("curl --fail http://localhost:7878/")
'';
})
14 changes: 6 additions & 8 deletions nixos/tests/redis.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, ...} : {
import ./make-test-python.nix ({ pkgs, ...} : {
name = "redis";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ flokli ];
@@ -15,12 +15,10 @@ import ./make-test.nix ({ pkgs, ...} : {
};

testScript = ''
startAll;
$machine->waitForUnit("redis");
$machine->waitForOpenPort("6379");
$machine->succeed("redis-cli ping | grep PONG");
$machine->succeed("redis-cli -s /run/redis/redis.sock ping | grep PONG");
start_all()
machine.wait_for_unit("redis")
machine.wait_for_open_port("6379")
machine.succeed("redis-cli ping | grep PONG")
machine.succeed("redis-cli -s /run/redis/redis.sock ping | grep PONG")
'';
})
12 changes: 6 additions & 6 deletions nixos/tests/roundcube.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, ...} : {
import ./make-test-python.nix ({ pkgs, ...} : {
name = "roundcube";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ globin ];
@@ -21,10 +21,10 @@ import ./make-test.nix ({ pkgs, ...} : {
};

testScript = ''
$roundcube->start;
$roundcube->waitForUnit("postgresql.service");
$roundcube->waitForUnit("phpfpm-roundcube.service");
$roundcube->waitForUnit("nginx.service");
$roundcube->succeed("curl -sSfL http://roundcube/ | grep 'Keep me logged in'");
roundcube.start
roundcube.wait_for_unit("postgresql.service")
roundcube.wait_for_unit("phpfpm-roundcube.service")
roundcube.wait_for_unit("nginx.service")
roundcube.succeed("curl -sSfL http://roundcube/ | grep 'Keep me logged in'")
'';
})
16 changes: 8 additions & 8 deletions nixos/tests/rss2email.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix {
import ./make-test-python.nix {
name = "opensmtpd";

nodes = {
@@ -53,14 +53,14 @@ import ./make-test.nix {
};

testScript = ''
startAll;
start_all()
$server->waitForUnit("network-online.target");
$server->waitForUnit("opensmtpd");
$server->waitForUnit("dovecot2");
$server->waitForUnit("nginx");
$server->waitForUnit("rss2email");
server.wait_for_unit("network-online.target")
server.wait_for_unit("opensmtpd")
server.wait_for_unit("dovecot2")
server.wait_for_unit("nginx")
server.wait_for_unit("rss2email")
$server->waitUntilSucceeds('check-mail-landed >&2');
server.wait_until_succeeds("check-mail-landed >&2")
'';
}
12 changes: 6 additions & 6 deletions nixos/tests/signal-desktop.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, ...} :
import ./make-test-python.nix ({ pkgs, ...} :

{
name = "signal-desktop";
@@ -24,14 +24,14 @@ import ./make-test.nix ({ pkgs, ...} :
testScript = { nodes, ... }: let
user = nodes.machine.config.users.users.alice;
in ''
startAll;
$machine->waitForX;
start_all()
machine.wait_for_x()
# start signal desktop
$machine->execute("su - alice -c signal-desktop &");
machine.execute("su - alice -c signal-desktop &")
# wait for the "Link your phone to Signal Desktop" message
$machine->waitForText(qr/Link your phone to Signal Desktop/);
$machine->screenshot("signal_desktop");
machine.wait_for_text("Link your phone to Signal Desktop")
machine.screenshot("signal_desktop")
'';
})
32 changes: 12 additions & 20 deletions nixos/tests/snapper.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ ... }:
import ./make-test-python.nix ({ ... }:
{
name = "snapper";

@@ -20,24 +20,16 @@ import ./make-test.nix ({ ... }:
};

testScript = ''
$machine->succeed("btrfs subvolume create /home/.snapshots");
$machine->succeed("snapper -c home list");
$machine->succeed("snapper -c home create --description empty");
$machine->succeed("echo test > /home/file");
$machine->succeed("snapper -c home create --description file");
$machine->succeed("snapper -c home status 1..2");
$machine->succeed("snapper -c home undochange 1..2");
$machine->fail("ls /home/file");
$machine->succeed("snapper -c home delete 2");
$machine->succeed("systemctl --wait start snapper-timeline.service");
$machine->succeed("systemctl --wait start snapper-cleanup.service");
machine.succeed("btrfs subvolume create /home/.snapshots")
machine.succeed("snapper -c home list")
machine.succeed("snapper -c home create --description empty")
machine.succeed("echo test > /home/file")
machine.succeed("snapper -c home create --description file")
machine.succeed("snapper -c home status 1..2")
machine.succeed("snapper -c home undochange 1..2")
machine.fail("ls /home/file")
machine.succeed("snapper -c home delete 2")
machine.succeed("systemctl --wait start snapper-timeline.service")
machine.succeed("systemctl --wait start snapper-cleanup.service")
'';
})
6 changes: 3 additions & 3 deletions nixos/tests/strongswan-swanctl.nix
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
# See the NixOS manual for how to run this test:
# https://nixos.org/nixos/manual/index.html#sec-running-nixos-tests-interactively

import ./make-test.nix ({ pkgs, ...} :
import ./make-test-python.nix ({ pkgs, ...} :

let
allowESP = "iptables --insert INPUT --protocol ESP --jump ACCEPT";
@@ -142,7 +142,7 @@ in {

};
testScript = ''
startAll();
$carol->waitUntilSucceeds("ping -c 1 alice");
start_all()
carol.wait_until_succeeds("ping -c 1 alice")
'';
})
8 changes: 4 additions & 4 deletions nixos/tests/telegraf.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, ...} : {
import ./make-test-python.nix ({ pkgs, ...} : {
name = "telegraf";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ mic92 ];
@@ -22,9 +22,9 @@ import ./make-test.nix ({ pkgs, ...} : {
};

testScript = ''
startAll;
start_all()
$machine->waitForUnit("telegraf.service");
$machine->waitUntilSucceeds("grep -q example /tmp/metrics.out");
machine.wait_for_unit("telegraf.service")
machine.wait_until_succeeds("grep -q example /tmp/metrics.out")
'';
})
30 changes: 19 additions & 11 deletions nixos/tests/trickster.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, ... }: {
import ./make-test-python.nix ({ pkgs, ... }: {
name = "trickster";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ "1000101" ];
@@ -15,15 +15,23 @@ import ./make-test.nix ({ pkgs, ... }: {
};

testScript = ''
startAll;
$prometheus->waitForUnit("prometheus.service");
$prometheus->waitForOpenPort(9090);
$prometheus->waitUntilSucceeds("curl -L http://localhost:9090/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'");
$trickster->waitForUnit("trickster.service");
$trickster->waitForOpenPort(8082);
$trickster->waitForOpenPort(9090);
$trickster->waitUntilSucceeds("curl -L http://localhost:8082/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'");
$trickster->waitUntilSucceeds("curl -L http://prometheus:9090/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'");
$trickster->waitUntilSucceeds("curl -L http://localhost:9090/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'");
start_all()
prometheus.wait_for_unit("prometheus.service")
prometheus.wait_for_open_port(9090)
prometheus.wait_until_succeeds(
"curl -L http://localhost:9090/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'"
)
trickster.wait_for_unit("trickster.service")
trickster.wait_for_open_port(8082)
trickster.wait_for_open_port(9090)
trickster.wait_until_succeeds(
"curl -L http://localhost:8082/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'"
)
trickster.wait_until_succeeds(
"curl -L http://prometheus:9090/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'"
)
trickster.wait_until_succeeds(
"curl -L http://localhost:9090/metrics | grep 'promhttp_metric_handler_requests_total{code=\"500\"} 0'"
)
'';
})
20 changes: 10 additions & 10 deletions nixos/tests/upnp.nix
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
# this succeeds an external client will try to connect to the port
# mapping.

import ./make-test.nix ({ pkgs, ... }:
import ./make-test-python.nix ({ pkgs, ... }:

let
internalRouterAddress = "192.168.3.1";
@@ -75,20 +75,20 @@ in
testScript =
{ nodes, ... }:
''
startAll;
start_all()
# Wait for network and miniupnpd.
$router->waitForUnit("network-online.target");
# $router->waitForUnit("nat");
$router->waitForUnit("firewall.service");
$router->waitForUnit("miniupnpd");
router.wait_for_unit("network-online.target")
# $router.wait_for_unit("nat")
router.wait_for_unit("firewall.service")
router.wait_for_unit("miniupnpd")
$client1->waitForUnit("network-online.target");
client1.wait_for_unit("network-online.target")
$client1->succeed("upnpc -a ${internalClient1Address} 9000 9000 TCP");
client1.succeed("upnpc -a ${internalClient1Address} 9000 9000 TCP")
$client1->waitForUnit("httpd");
$client2->waitUntilSucceeds("curl http://${externalRouterAddress}:9000/");
client1.wait_for_unit("httpd")
client2.wait_until_succeeds("curl http://${externalRouterAddress}:9000/")
'';

})
12 changes: 6 additions & 6 deletions nixos/tests/xautolock.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, lib, ... }:
import ./make-test-python.nix ({ pkgs, lib, ... }:

with lib;

@@ -15,10 +15,10 @@ with lib;
};

testScript = ''
$machine->start;
$machine->waitForX;
$machine->mustFail("pgrep xlock");
$machine->sleep(120);
$machine->mustSucceed("pgrep xlock");
machine.start()
machine.wait_for_x()
machine.fail("pgrep xlock")
machine.sleep(120)
machine.succeed("pgrep xlock")
'';
})
14 changes: 7 additions & 7 deletions nixos/tests/yabar.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, lib, ... }:
import ./make-test-python.nix ({ pkgs, lib, ... }:

with lib;

@@ -20,14 +20,14 @@ with lib;
};

testScript = ''
$machine->start;
$machine->waitForX;
machine.start()
machine.wait_for_x()
# confirm proper startup
$machine->waitForUnit("yabar.service", "bob");
$machine->sleep(10);
$machine->waitForUnit("yabar.service", "bob");
machine.wait_for_unit("yabar.service", "bob")
machine.sleep(10)
machine.wait_for_unit("yabar.service", "bob")
$machine->screenshot("top_bar");
machine.screenshot("top_bar")
'';
})
22 changes: 14 additions & 8 deletions nixos/tests/zookeeper.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, ...} : {
import ./make-test-python.nix ({ pkgs, ...} : {
name = "zookeeper";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ nequissimus ];
@@ -15,14 +15,20 @@ import ./make-test.nix ({ pkgs, ...} : {
};

testScript = ''
startAll;
start_all()
$server->waitForUnit("zookeeper");
$server->waitForUnit("network.target");
$server->waitForOpenPort(2181);
server.wait_for_unit("zookeeper")
server.wait_for_unit("network.target")
server.wait_for_open_port(2181)
$server->waitUntilSucceeds("${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 create /foo bar");
$server->waitUntilSucceeds("${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 set /foo hello");
$server->waitUntilSucceeds("${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 get /foo | grep hello");
server.wait_until_succeeds(
"${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 create /foo bar"
)
server.wait_until_succeeds(
"${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 set /foo hello"
)
server.wait_until_succeeds(
"${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 get /foo | grep hello"
)
'';
})