summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2021-05-09 09:31:27 +0200
committerVladimír Čunát <v@cunat.cz>2021-05-09 09:31:55 +0200
commit5663b2b2d385c06bffeb8514dec22d5e2838bdcb (patch)
tree6bfa3064e3b40ed97da05c5c8a48bfa63360ab91 /nixos/tests
parent9f024e4c929bee8ed4a45a39e8fc5d5ff9bf7185 (diff)
parent90c2fb1f2fd0ef3f0e453bc8cd6b28866e079aa0 (diff)
downloadnixpkgs-5663b2b2d385c06bffeb8514dec22d5e2838bdcb.tar
nixpkgs-5663b2b2d385c06bffeb8514dec22d5e2838bdcb.tar.gz
nixpkgs-5663b2b2d385c06bffeb8514dec22d5e2838bdcb.tar.bz2
nixpkgs-5663b2b2d385c06bffeb8514dec22d5e2838bdcb.tar.lz
nixpkgs-5663b2b2d385c06bffeb8514dec22d5e2838bdcb.tar.xz
nixpkgs-5663b2b2d385c06bffeb8514dec22d5e2838bdcb.tar.zst
nixpkgs-5663b2b2d385c06bffeb8514dec22d5e2838bdcb.zip
Merge branch 'master' into staging-next
(a trivial conflict in transmission)
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/acme.nix2
-rw-r--r--nixos/tests/chromium.nix3
-rw-r--r--nixos/tests/containers-custom-pkgs.nix2
-rw-r--r--nixos/tests/containers-imperative.nix2
-rw-r--r--nixos/tests/custom-ca.nix1
-rw-r--r--nixos/tests/docker-tools-cross.nix3
-rw-r--r--nixos/tests/docker-tools-overlay.nix3
-rw-r--r--nixos/tests/docker-tools.nix3
-rw-r--r--nixos/tests/jellyfin.nix5
-rw-r--r--nixos/tests/networking.nix6
-rw-r--r--nixos/tests/nfs/kerberos.nix8
-rw-r--r--nixos/tests/printing.nix1
-rw-r--r--nixos/tests/shadow.nix24
-rw-r--r--nixos/tests/unbound.nix1
-rw-r--r--nixos/tests/virtualbox.nix20
-rw-r--r--nixos/tests/yggdrasil.nix2
16 files changed, 35 insertions, 51 deletions
diff --git a/nixos/tests/acme.nix b/nixos/tests/acme.nix
index 99dd8ec6fd3..6f98b0da378 100644
--- a/nixos/tests/acme.nix
+++ b/nixos/tests/acme.nix
@@ -245,7 +245,7 @@ in import ./make-test-python.nix ({ lib, ... }: {
           )
           for line in subject_data.lower().split("\n"):
               if "subject" in line:
-                  print(f"First subject in fullchain.pem: ", line)
+                  print(f"First subject in fullchain.pem: {line}")
                   assert cert_name.lower() in line
                   return
 
diff --git a/nixos/tests/chromium.nix b/nixos/tests/chromium.nix
index 8429d932ae6..60ecf986d6e 100644
--- a/nixos/tests/chromium.nix
+++ b/nixos/tests/chromium.nix
@@ -54,7 +54,8 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
     in "${pkgs.xdotool}/bin/xdotool ${xdoScript}";
   in ''
     import shlex
-    from contextlib import contextmanager, _GeneratorContextManager
+    import re
+    from contextlib import contextmanager
 
 
     # Run as user alice
diff --git a/nixos/tests/containers-custom-pkgs.nix b/nixos/tests/containers-custom-pkgs.nix
index c050e49bc29..1627a2c70c3 100644
--- a/nixos/tests/containers-custom-pkgs.nix
+++ b/nixos/tests/containers-custom-pkgs.nix
@@ -30,5 +30,5 @@ in {
   };
 
   # This test only consists of evaluating the test machine
-  testScript = "";
+  testScript = "pass";
 })
diff --git a/nixos/tests/containers-imperative.nix b/nixos/tests/containers-imperative.nix
index bb207165a02..1dcccfc306a 100644
--- a/nixos/tests/containers-imperative.nix
+++ b/nixos/tests/containers-imperative.nix
@@ -162,6 +162,6 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: {
           machine.fail(
               "nixos-container create b0rk --config-file ${brokenCfg}"
           )
-          machine.succeed(f"test ! -e /var/lib/containers/b0rk")
+          machine.succeed("test ! -e /var/lib/containers/b0rk")
     '';
 })
diff --git a/nixos/tests/custom-ca.nix b/nixos/tests/custom-ca.nix
index 31909188d3a..7ce1101911d 100644
--- a/nixos/tests/custom-ca.nix
+++ b/nixos/tests/custom-ca.nix
@@ -112,6 +112,7 @@ in
     };
 
   testScript = ''
+    from typing import Tuple
     def execute_as(user: str, cmd: str) -> Tuple[int, str]:
         """
         Run a shell command as a specific user.
diff --git a/nixos/tests/docker-tools-cross.nix b/nixos/tests/docker-tools-cross.nix
index 91a6c954008..a7a6a31475d 100644
--- a/nixos/tests/docker-tools-cross.nix
+++ b/nixos/tests/docker-tools-cross.nix
@@ -73,7 +73,4 @@ in {
             "docker rmi ${hello2.imageName}",
         )
   '';
-
-  # Remove when the formatter has been removed and a linter has been added
-  skipLint = true;
 })
diff --git a/nixos/tests/docker-tools-overlay.nix b/nixos/tests/docker-tools-overlay.nix
index b4504032019..6781388e639 100644
--- a/nixos/tests/docker-tools-overlay.nix
+++ b/nixos/tests/docker-tools-overlay.nix
@@ -30,7 +30,4 @@ import ./make-test-python.nix ({ pkgs, ... }:
       # drw------- 99 0 0 100 Apr 14 11:36 /nix/store
       docker.succeed("docker run --rm -u 1000:1000 ${pkgs.dockerTools.examples.bash.imageName} bash --version")
     '';
-
-  # Remove when the formatter has been removed and a linter has been added
-  skipLint = true;
 })
diff --git a/nixos/tests/docker-tools.nix b/nixos/tests/docker-tools.nix
index 650648fe724..39b97b4cb99 100644
--- a/nixos/tests/docker-tools.nix
+++ b/nixos/tests/docker-tools.nix
@@ -365,7 +365,4 @@ import ./make-test-python.nix ({ pkgs, ... }: {
             "docker run --rm ${examples.layeredImageWithFakeRootCommands.imageName} sh -c 'stat -c '%u' /home/jane | grep -E ^1000$'"
         )
   '';
-
-  # Remove when the formatter has been removed and a linter has been added
-  skipLint = true;
 })
diff --git a/nixos/tests/jellyfin.nix b/nixos/tests/jellyfin.nix
index f8c2429a7b8..cae31a71925 100644
--- a/nixos/tests/jellyfin.nix
+++ b/nixos/tests/jellyfin.nix
@@ -24,7 +24,6 @@ import ./make-test-python.nix ({ lib, pkgs, ... }:
       in
       ''
         import json
-        import time
         from urllib.parse import urlencode
 
         machine.wait_for_unit("jellyfin.service")
@@ -101,7 +100,7 @@ import ./make-test-python.nix ({ lib, pkgs, ... }:
 
 
         def is_refreshed(_):
-            folders = machine.succeed(api_get(f"/Library/VirtualFolders"))
+            folders = machine.succeed(api_get("/Library/VirtualFolders"))
             folders = json.loads(folders)
             print(folders)
             return all(folder["RefreshStatus"] == "Idle" for folder in folders)
@@ -141,7 +140,7 @@ import ./make-test-python.nix ({ lib, pkgs, ... }:
                 "ffmpeg"
                 + f" -headers 'X-Emby-Authorization:{auth_header}'"
                 + f" -i http://localhost:8096/Videos/{video}/master.m3u8?mediaSourceId={media_source_id}"
-                + f" /tmp/test.mkv"
+                + " /tmp/test.mkv"
             )
 
             duration = machine.succeed(
diff --git a/nixos/tests/networking.nix b/nixos/tests/networking.nix
index 1ea61f99a95..c8756207f27 100644
--- a/nixos/tests/networking.nix
+++ b/nixos/tests/networking.nix
@@ -511,7 +511,7 @@ let
             machine.sleep(10)
             residue = machine.succeed("ip tuntap list")
             assert (
-                residue is ""
+                residue == ""
             ), "Some virtual interface has not been properly cleaned:\n{}".format(residue)
       '';
     };
@@ -665,10 +665,10 @@ let
             ipv4Residue = machine.succeed("ip -4 route list dev eth0 | head -n-3").strip()
             ipv6Residue = machine.succeed("ip -6 route list dev eth0 | head -n-3").strip()
             assert (
-                ipv4Residue is ""
+                ipv4Residue == ""
             ), "The IPv4 routing table has not been properly cleaned:\n{}".format(ipv4Residue)
             assert (
-                ipv6Residue is ""
+                ipv6Residue == ""
             ), "The IPv6 routing table has not been properly cleaned:\n{}".format(ipv6Residue)
       '';
     };
diff --git a/nixos/tests/nfs/kerberos.nix b/nixos/tests/nfs/kerberos.nix
index 75d1210496b..5684131f671 100644
--- a/nixos/tests/nfs/kerberos.nix
+++ b/nixos/tests/nfs/kerberos.nix
@@ -88,8 +88,8 @@ in
           "kdb5_util create -s -r NFS.TEST -P master_key",
           "systemctl restart kadmind.service kdc.service",
       )
-      server.wait_for_unit(f"kadmind.service")
-      server.wait_for_unit(f"kdc.service")
+      server.wait_for_unit("kadmind.service")
+      server.wait_for_unit("kdc.service")
 
       # create principals
       server.succeed(
@@ -102,8 +102,8 @@ in
       # add principals to server keytab
       server.succeed("kadmin.local ktadd nfs/server.nfs.test")
       server.succeed("systemctl start rpc-gssd.service rpc-svcgssd.service")
-      server.wait_for_unit(f"rpc-gssd.service")
-      server.wait_for_unit(f"rpc-svcgssd.service")
+      server.wait_for_unit("rpc-gssd.service")
+      server.wait_for_unit("rpc-svcgssd.service")
 
       client.wait_for_unit("network-online.target")
 
diff --git a/nixos/tests/printing.nix b/nixos/tests/printing.nix
index 6a1801fb288..b2f2540fb7a 100644
--- a/nixos/tests/printing.nix
+++ b/nixos/tests/printing.nix
@@ -50,7 +50,6 @@ in {
   testScript = ''
     import os
     import re
-    import sys
 
     start_all()
 
diff --git a/nixos/tests/shadow.nix b/nixos/tests/shadow.nix
index c51961e1fc6..dd2a575b193 100644
--- a/nixos/tests/shadow.nix
+++ b/nixos/tests/shadow.nix
@@ -36,9 +36,9 @@ in import ./make-test-python.nix ({ pkgs, ... }: {
 
     with subtest("Normal login"):
         shadow.send_key("alt-f2")
-        shadow.wait_until_succeeds(f"[ $(fgconsole) = 2 ]")
-        shadow.wait_for_unit(f"getty@tty2.service")
-        shadow.wait_until_succeeds(f"pgrep -f 'agetty.*tty2'")
+        shadow.wait_until_succeeds("[ $(fgconsole) = 2 ]")
+        shadow.wait_for_unit("getty@tty2.service")
+        shadow.wait_until_succeeds("pgrep -f 'agetty.*tty2'")
         shadow.wait_until_tty_matches(2, "login: ")
         shadow.send_chars("emma\n")
         shadow.wait_until_tty_matches(2, "login: emma")
@@ -60,9 +60,9 @@ in import ./make-test-python.nix ({ pkgs, ... }: {
 
     with subtest("Change password"):
         shadow.send_key("alt-f3")
-        shadow.wait_until_succeeds(f"[ $(fgconsole) = 3 ]")
-        shadow.wait_for_unit(f"getty@tty3.service")
-        shadow.wait_until_succeeds(f"pgrep -f 'agetty.*tty3'")
+        shadow.wait_until_succeeds("[ $(fgconsole) = 3 ]")
+        shadow.wait_for_unit("getty@tty3.service")
+        shadow.wait_until_succeeds("pgrep -f 'agetty.*tty3'")
         shadow.wait_until_tty_matches(3, "login: ")
         shadow.send_chars("emma\n")
         shadow.wait_until_tty_matches(3, "login: emma")
@@ -78,9 +78,9 @@ in import ./make-test-python.nix ({ pkgs, ... }: {
         shadow.send_chars("${password3}\n")
         shadow.sleep(2)
         shadow.send_key("alt-f4")
-        shadow.wait_until_succeeds(f"[ $(fgconsole) = 4 ]")
-        shadow.wait_for_unit(f"getty@tty4.service")
-        shadow.wait_until_succeeds(f"pgrep -f 'agetty.*tty4'")
+        shadow.wait_until_succeeds("[ $(fgconsole) = 4 ]")
+        shadow.wait_for_unit("getty@tty4.service")
+        shadow.wait_until_succeeds("pgrep -f 'agetty.*tty4'")
         shadow.wait_until_tty_matches(4, "login: ")
         shadow.send_chars("emma\n")
         shadow.wait_until_tty_matches(4, "login: emma")
@@ -106,9 +106,9 @@ in import ./make-test-python.nix ({ pkgs, ... }: {
 
     with subtest("nologin shell"):
         shadow.send_key("alt-f5")
-        shadow.wait_until_succeeds(f"[ $(fgconsole) = 5 ]")
-        shadow.wait_for_unit(f"getty@tty5.service")
-        shadow.wait_until_succeeds(f"pgrep -f 'agetty.*tty5'")
+        shadow.wait_until_succeeds("[ $(fgconsole) = 5 ]")
+        shadow.wait_for_unit("getty@tty5.service")
+        shadow.wait_until_succeeds("pgrep -f 'agetty.*tty5'")
         shadow.wait_until_tty_matches(5, "login: ")
         shadow.send_chars("layla\n")
         shadow.wait_until_tty_matches(5, "login: layla")
diff --git a/nixos/tests/unbound.nix b/nixos/tests/unbound.nix
index e24c3ef6c99..fcfa222299c 100644
--- a/nixos/tests/unbound.nix
+++ b/nixos/tests/unbound.nix
@@ -192,7 +192,6 @@ import ./make-test-python.nix ({ pkgs, lib, ... }:
 
     testScript = { nodes, ... }: ''
       import typing
-      import json
 
       zone = "example.local."
       records = [("AAAA", "abcd::eeff"), ("A", "1.2.3.4")]
diff --git a/nixos/tests/virtualbox.nix b/nixos/tests/virtualbox.nix
index 0a7369b0fa2..09314d93b7d 100644
--- a/nixos/tests/virtualbox.nix
+++ b/nixos/tests/virtualbox.nix
@@ -226,18 +226,16 @@ let
 
 
       def create_vm_${name}():
-          # fmt: off
-          vbm(f"createvm --name ${name} ${createFlags}")
-          vbm(f"modifyvm ${name} ${vmFlags}")
-          vbm(f"setextradata ${name} VBoxInternal/PDM/HaltOnReset 1")
-          vbm(f"storagectl ${name} ${controllerFlags}")
-          vbm(f"storageattach ${name} ${diskFlags}")
-          vbm(f"sharedfolder add ${name} ${sharedFlags}")
-          vbm(f"sharedfolder add ${name} ${nixstoreFlags}")
+          vbm("createvm --name ${name} ${createFlags}")
+          vbm("modifyvm ${name} ${vmFlags}")
+          vbm("setextradata ${name} VBoxInternal/PDM/HaltOnReset 1")
+          vbm("storagectl ${name} ${controllerFlags}")
+          vbm("storageattach ${name} ${diskFlags}")
+          vbm("sharedfolder add ${name} ${sharedFlags}")
+          vbm("sharedfolder add ${name} ${nixstoreFlags}")
           cleanup_${name}()
 
           ${mkLog "$HOME/VirtualBox VMs/${name}/Logs/VBox.log" "HOST-${name}"}
-          # fmt: on
 
 
       def destroy_vm_${name}():
@@ -259,9 +257,7 @@ let
 
       def wait_for_ip_${name}(interface):
           property = f"/VirtualBox/GuestInfo/Net/{interface}/V4/IP"
-          # fmt: off
           getip = f"VBoxManage guestproperty get ${name} {property} | sed -n -e 's/^Value: //p'"
-          # fmt: on
 
           ip = machine.succeed(
               ru(
@@ -394,9 +390,7 @@ let
 
       machine.wait_for_x()
 
-      # fmt: off
       ${mkLog "$HOME/.config/VirtualBox/VBoxSVC.log" "HOST-SVC"}
-      # fmt: on
 
       ${testScript}
       # (keep black happy)
diff --git a/nixos/tests/yggdrasil.nix b/nixos/tests/yggdrasil.nix
index 0b58ad29aa2..0e75ed54db2 100644
--- a/nixos/tests/yggdrasil.nix
+++ b/nixos/tests/yggdrasil.nix
@@ -147,7 +147,7 @@ in import ./make-test-python.nix ({ pkgs, ...} : {
       # If Alice can talk to Carol, then Bob's outbound peering and Carol's
       # local peering have succeeded and everybody is connected.
       alice.wait_until_succeeds(f"ping -c 1 {carol_ip6}")
-      alice.succeed(f"ping -c 1 ${bobIp6}")
+      alice.succeed("ping -c 1 ${bobIp6}")
 
       bob.succeed("ping -c 1 ${aliceIp6}")
       bob.succeed(f"ping -c 1 {carol_ip6}")