After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build a08b3a4d19.tar.gz \
--argstr baseRev b32a0943687d2a5094a6d92f25a4b6e16a76b5b7
result/bin/apply-formatting $NIXPKGS_PATH
60 lines
2.0 KiB
Nix
60 lines
2.0 KiB
Nix
import ./make-test-python.nix (
|
|
{ pkgs, ... }:
|
|
{
|
|
name = "timezone";
|
|
meta.maintainers = with pkgs.lib.maintainers; [ ];
|
|
|
|
nodes = {
|
|
node_eutz =
|
|
{ pkgs, ... }:
|
|
{
|
|
time.timeZone = "Europe/Amsterdam";
|
|
};
|
|
|
|
node_nulltz =
|
|
{ pkgs, ... }:
|
|
{
|
|
time.timeZone = null;
|
|
};
|
|
};
|
|
|
|
testScript =
|
|
{ nodes, ... }:
|
|
''
|
|
node_eutz.wait_for_unit("dbus.socket")
|
|
|
|
with subtest("static - Ensure timezone change gives the correct result"):
|
|
node_eutz.fail("timedatectl set-timezone Asia/Tokyo")
|
|
date_result = node_eutz.succeed('date -d @0 "+%Y-%m-%d %H:%M:%S"')
|
|
assert date_result == "1970-01-01 01:00:00\n", "Timezone seems to be wrong"
|
|
|
|
node_nulltz.wait_for_unit("dbus.socket")
|
|
|
|
with subtest("imperative - Ensure timezone defaults to UTC"):
|
|
date_result = node_nulltz.succeed('date -d @0 "+%Y-%m-%d %H:%M:%S"')
|
|
print(date_result)
|
|
assert (
|
|
date_result == "1970-01-01 00:00:00\n"
|
|
), "Timezone seems to be wrong (not UTC)"
|
|
|
|
with subtest("imperative - Ensure timezone adjustment produces expected result"):
|
|
node_nulltz.succeed("timedatectl set-timezone Asia/Tokyo")
|
|
|
|
# Adjustment should be taken into account
|
|
date_result = node_nulltz.succeed('date -d @0 "+%Y-%m-%d %H:%M:%S"')
|
|
print(date_result)
|
|
assert date_result == "1970-01-01 09:00:00\n", "Timezone was not adjusted"
|
|
|
|
with subtest("imperative - Ensure timezone adjustment persists across reboot"):
|
|
# Adjustment should persist across a reboot
|
|
node_nulltz.shutdown()
|
|
node_nulltz.wait_for_unit("dbus.socket")
|
|
date_result = node_nulltz.succeed('date -d @0 "+%Y-%m-%d %H:%M:%S"')
|
|
print(date_result)
|
|
assert (
|
|
date_result == "1970-01-01 09:00:00\n"
|
|
), "Timezone adjustment was not persisted"
|
|
'';
|
|
}
|
|
)
|