remove unused code
This commit is contained in:
parent
a91c419858
commit
6931853de3
14 changed files with 9 additions and 198 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
pkgs ? import <nixpkgs> { },
|
||||
qpkgs ? let
|
||||
src = fetchTree (builtins.parseFlakeRef "github:Qyriad/nur-packages");
|
||||
src = fetchTarball "https://github.com/Qyriad/nur-packages/archive/main.tar.gz";
|
||||
in import src { inherit pkgs; },
|
||||
callPackage ? qpkgs.callPackage,
|
||||
lib ? qpkgs.lib,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import argparse
|
||||
import functools
|
||||
#from pathlib import Path
|
||||
#from pprint import pformat
|
||||
import shlex
|
||||
import textwrap
|
||||
from typing import Any, cast, TYPE_CHECKING
|
||||
|
|
@ -64,7 +62,6 @@ def get_cli_args() -> argparse.Namespace:
|
|||
machine.log(f"{cmdline_args=}")
|
||||
print(f"{cmdline_args=}")
|
||||
|
||||
#return shlex.join(cmdline_args[1:])
|
||||
args, rest = parser.parse_known_args(cmdline_args)
|
||||
return args
|
||||
|
||||
|
|
@ -77,12 +74,7 @@ def dynix_append(option: str, value: Any):
|
|||
@beartype
|
||||
def do_apply():
|
||||
expr = textwrap.dedent("""
|
||||
let
|
||||
nixos = import <nixpkgs/nixos> { };
|
||||
in nixos.config.dynamicism.applyDynamicConfiguration {
|
||||
baseConfiguration = /etc/nixos/configuration.nix;
|
||||
newConfiguration = /etc/nixos/dynamic.nix;
|
||||
}
|
||||
(import <nixpkgs/nixos> { }).config.dynamicism.applyDynamicConfiguration { }
|
||||
""").strip()
|
||||
|
||||
machine.succeed(rf"""
|
||||
|
|
@ -95,7 +87,6 @@ machine.log("INIT")
|
|||
|
||||
# Config should have our initial values.
|
||||
args = get_cli_args()
|
||||
#assert '--jobs 12' in args, f'--jobs 12 not in {args=}'
|
||||
assert args.jobs == 12, f'{args.jobs=} != 12'
|
||||
assert args.job_lifetime == 900, f'{args.job_lifetime} != 900'
|
||||
assert args.log_level == 'warning', f'{args.log_level=} != warning'
|
||||
|
|
@ -105,10 +96,13 @@ with machine.nested("must succeed: initial nixos-rebuild switch"):
|
|||
|
||||
# Config should not have changed.
|
||||
args = get_cli_args()
|
||||
assert args.jobs == 12, f'{args.jobs=} != 12'
|
||||
assert args.job_lifetime == 900, f'{args.job_lifetime} != 900'
|
||||
assert args.log_level == 'warning', f'{args.log_level=} != warning'
|
||||
#machine.log(f"config.toml after first rebuild: {indent(pformat(args))}")
|
||||
#assert int(args['workers']) == 4, f"{args['workers']=} != 4"
|
||||
#assert int(args['max_connection_rate']) == 256, f"{args['max_connection_rate']=} != 256"
|
||||
#
|
||||
|
||||
new_jobs = 4
|
||||
dynix_append("services.distccd.maxJobs", new_jobs)
|
||||
do_apply()
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
runCommand,
|
||||
}: runCommand "tests-gotosocial-configuration-dot-nix" {
|
||||
} ''
|
||||
set -euo pipefail
|
||||
install -Dm a=r ${./configuration.nix} "$out/share/nixos/configuration.nix"
|
||||
''
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
/**
|
||||
* Convenience shortcut for running this test from the command-line.
|
||||
* Normally this test is initialized from /tests/default.nix.
|
||||
*/
|
||||
{
|
||||
pkgs ? import <nixpkgs> { },
|
||||
}: pkgs.testers.runNixOSTest ./test.nix
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
/** Dummy hardware configuration.
|
||||
* Will be replaced with the real one in the test VM.
|
||||
*/
|
||||
{ ... }:
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -61,12 +61,7 @@ def dynix_append(option: str, value: str):
|
|||
@beartype
|
||||
def do_apply():
|
||||
expr = textwrap.dedent("""
|
||||
let
|
||||
nixos = import <nixpkgs/nixos> { };
|
||||
in nixos.config.dynamicism.applyDynamicConfiguration {
|
||||
baseConfiguration = /etc/nixos/configuration.nix;
|
||||
newConfiguration = /etc/nixos/dynamic.nix;
|
||||
}
|
||||
(import <nixpkgs/nixos> { }).config.dynamicism.applyDynamicConfiguration { }
|
||||
""").strip()
|
||||
|
||||
machine.succeed(rf"""
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
{ ... }:
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -64,12 +64,7 @@ def dynix_append(option: str, value: Any):
|
|||
@beartype
|
||||
def do_apply():
|
||||
expr = textwrap.dedent("""
|
||||
let
|
||||
nixos = import <nixpkgs/nixos> { };
|
||||
in nixos.config.dynamicism.applyDynamicConfiguration {
|
||||
baseConfiguration = /etc/nixos/configuration.nix;
|
||||
newConfiguration = /etc/nixos/dynamic.nix;
|
||||
}
|
||||
(import <nixpkgs/nixos> { }).config.dynamicism.applyDynamicConfiguration { }
|
||||
""").strip()
|
||||
|
||||
machine.succeed(rf"""
|
||||
|
|
|
|||
|
|
@ -1,67 +0,0 @@
|
|||
{ pkgs, lib, config, modulesPath, ... }:
|
||||
let
|
||||
name = config.networking.hostName;
|
||||
moduleList = import "${modulesPath}/module-list.nix";
|
||||
|
||||
dynixFromSearchPath = let
|
||||
res = builtins.tryEval <dynix>;
|
||||
in lib.optional res.success res.value;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
"${modulesPath}/testing/test-instrumentation.nix"
|
||||
./hardware-configuration.nix
|
||||
] ++ lib.concatLists [
|
||||
moduleList
|
||||
dynixFromSearchPath
|
||||
];
|
||||
|
||||
dynamicism.for.tzupdate.enable = true;
|
||||
services.tzupdate = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
system.switch.enable = true;
|
||||
documentation.enable = false;
|
||||
|
||||
networking.hostName = "tzupdate-machine";
|
||||
|
||||
boot.loader.grub = {
|
||||
enable = true;
|
||||
device = "/dev/vda";
|
||||
forceInstall = true;
|
||||
};
|
||||
|
||||
nix = {
|
||||
package = pkgs.lixPackageSets.latest.lix;
|
||||
nixPath = [
|
||||
"nixpkgs=${pkgs.path}"
|
||||
"/nix/var/nix/profiles/per-user/root/profile/share/nixos/modules"
|
||||
];
|
||||
|
||||
settings = {
|
||||
experimental-features = [ "nix-command" "pipe-operator" ];
|
||||
substituters = lib.mkForce [ ];
|
||||
hashed-mirrors = null;
|
||||
connect-timeout = 1;
|
||||
# For my debugging purposes.
|
||||
show-trace = true;
|
||||
};
|
||||
};
|
||||
|
||||
environment.pathsToLink = [ "/share" ];
|
||||
environment.extraOutputsToInstall = [ "modules" ];
|
||||
environment.variables = {
|
||||
"NIXOS_CONFIG" = "/etc/nixos/configuration.nix";
|
||||
};
|
||||
|
||||
environment.shellAliases = {
|
||||
ls = "eza --long --header --group --group-directories-first --classify --binary";
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
eza
|
||||
fd
|
||||
ripgrep
|
||||
];
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
{ ... }:
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
#from pathlib import Path
|
||||
#import shlex
|
||||
#import textwrap
|
||||
from typing import cast, TYPE_CHECKING
|
||||
|
||||
from beartype import beartype
|
||||
|
||||
from test_driver.machine import Machine
|
||||
from test_driver.errors import RequestedAssertionFailed
|
||||
|
||||
if TYPE_CHECKING:
|
||||
global machine
|
||||
machine = cast(Machine, ...)
|
||||
assert machine.shell is not None
|
||||
|
||||
ls = "eza -lah --color=always --group-directories-first"
|
||||
|
||||
@beartype
|
||||
def run_log(machine: Machine, *commands: str, timeout: int | None = 60) -> str:
|
||||
output = ""
|
||||
for command in commands:
|
||||
with machine.nested(f"must succeed: {command}"):
|
||||
(status, out) = machine.execute(f"{command} | tee /dev/stderr", timeout=timeout)
|
||||
if status != 0:
|
||||
machine.log(f"output: {out}")
|
||||
raise RequestedAssertionFailed(
|
||||
f"command `{command}` failed (exit code {status})",
|
||||
)
|
||||
output += out
|
||||
|
||||
return output
|
||||
|
||||
machine.wait_for_unit("default.target")
|
||||
assert "lix" in machine.succeed("nix --version").lower()
|
||||
machine.log("INIT")
|
||||
|
||||
|
||||
machine.succeed("nixos-generate-config")
|
||||
machine.succeed("mkdir -vp /etc/nixos")
|
||||
# Dereference is required since that configuration.nix is probably a symlink to the store.
|
||||
machine.succeed("cp -rv --dereference /run/current-system/sw/share/nixos/configuration.nix /etc/nixos/")
|
||||
|
||||
machine.succeed("env PAGER= nixos-rebuild switch --log-format raw-with-logs --fallback")
|
||||
|
||||
@beartype
|
||||
def get_interval() -> str:
|
||||
prop = machine.get_unit_property("tzupdate.timer", "OnCalendar")
|
||||
print(f"{prop=}")
|
||||
|
||||
return prop
|
||||
|
||||
get_interval()
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
name = "nixos-test-dynamicism-tzupdate";
|
||||
|
||||
extraPythonPackages = p: [
|
||||
p.beartype
|
||||
];
|
||||
|
||||
nodes.machine = { name, pkgs, ... }: {
|
||||
imports = [ ./configuration.nix ];
|
||||
|
||||
environment.systemPackages = let
|
||||
configFileTree = pkgs.runCommand "${name}-configuration-dot-nix" { } ''
|
||||
set -euo pipefail
|
||||
install -Dm a=r ${./configuration.nix} "$out/share/nixos/configuration.nix"
|
||||
'';
|
||||
in [
|
||||
configFileTree
|
||||
];
|
||||
};
|
||||
|
||||
testScript = builtins.readFile ./test-script.py;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue