Commit 53a22159 authored by Artturin's avatar Artturin
Browse files

nixosTests.misc: Revert nix changes

nix tests now moved to `nixosTests.nix-misc`

Revert "nixos/tests/misc: support old and new path-info output structure"

This reverts commit 903f315f.

Revert "nixos/tests/misc: call the tester `test` to be `callTest`-ed"

This reverts commit b35ccb7f.

Revert "nixos/tests/misc: rework and take ownership"

This reverts commit 81854ca6.
parent e124b02e
Loading
Loading
Loading
Loading
+161 −185
Original line number Diff line number Diff line
# Miscellaneous small tests that don't warrant their own VM run.
{ pkgs, ... }:

let
  inherit (pkgs) lib;
  tests = {
    default = testsForPackage { nixPackage = pkgs.nix; };
    lix = testsForPackage { nixPackage = pkgs.lix; };
  };

  testsForPackage = args: lib.recurseIntoAttrs {
    # If the attribute is not named 'test'
    # You will break all the universe on the release-*.nix side of things.
    # `discoverTests` relies on `test` existence to perform a `callTest`.
    test = testMiscFeatures args;
    passthru.override = args': testsForPackage (args // args');
  };

  testMiscFeatures = { nixPackage, ... }: pkgs.testers.nixosTest (
  let
import ./make-test-python.nix ({ lib, pkgs, ...} : let
  foo = pkgs.writeText "foo" "Hello World";
in {
  name = "misc";
    meta.maintainers = with lib.maintainers; [ raitobezarius ];
  meta.maintainers = with lib.maintainers; [ eelco ];

  nodes.machine =
    { lib, ... }:
@@ -57,8 +40,6 @@ let
      boot.kernel.sysctl."vm.swappiness" = 1;
      boot.kernelParams = [ "vsyscall=emulate" ];
      system.extraDependencies = [ foo ];

        nix.package = nixPackage;
    };

  testScript =
@@ -73,19 +54,16 @@ let


      with subtest("nix-db"):
            out = "${foo}"
            info = get_path_info(out)
          info = get_path_info("${foo}")
          print(info)

            pathinfo = info[0] if isinstance(info, list) else info[out]

          if (
                pathinfo["narHash"]
              info[0]["narHash"]
              != "sha256-BdMdnb/0eWy3EddjE83rdgzWWpQjfWPAj3zDIFMD3Ck="
          ):
              raise Exception("narHash not set")

            if pathinfo["narSize"] != 128:
          if info[0]["narSize"] != 128:
              raise Exception("narSize not set")

      with subtest("nixos-version"):
@@ -183,6 +161,4 @@ let
      with subtest("Test boot parameters"):
          assert "vsyscall=emulate" in machine.succeed("cat /proc/cmdline")
    '';
  });
  in
  tests
})