-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/tests/timezone: port to python #74858
Conversation
Can you add this test to |
@flokli yep, done. |
nixos/tests/timezone.nix
Outdated
my @dateResult = $machine->execute('date -d @0 "+%Y-%m-%d %H:%M:%S"'); | ||
print $dateResult[1]; | ||
$dateResult[1] eq "1970-01-01 09:00:00\n" or die "Timezone adjustment was not persisted"; | ||
machine.shutdown() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make comments like "Adjustment should persist across a reboot" a subtest, so this information is even visible in the log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tfc done
@GrahamcOfBorg test timezone |
nixos/tests/timezone.nix
Outdated
date_result = machine.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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The linter complains here:
⇒ nix-build nixos/tests/timezone.nix -A timezone-static
these derivations will be built:
/nix/store/q7dwy5fkiahdv9q65c17pzgh90aqxppj-nixos-test-driver-timezone-static.drv
/nix/store/769fsp2qh581h181ffg09n6dlb0pxmn2-vm-test-run-timezone-static.drv
building '/nix/store/q7dwy5fkiahdv9q65c17pzgh90aqxppj-nixos-test-driver-timezone-static.drv'...
--- /nix/store/q0z2dazvilyzyk57sw0y4fcfw80zmf3x-nixos-test-driver-timezone-static/test-script 2019-12-04 00:10:57.981288 +0000
+++ /nix/store/q0z2dazvilyzyk57sw0y4fcfw80zmf3x-nixos-test-driver-timezone-static/test-script 2019-12-04 00:10:58.142654 +0000
@@ -1,7 +1,5 @@
machine.wait_for_unit("dbus.socket")
machine.fail("timedatectl set-timezone Asia/Tokyo")
date_result = machine.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"
+assert date_result == "1970-01-01 01:00:00\n", "Timezone seems to be wrong"
would reformat /nix/store/q0z2dazvilyzyk57sw0y4fcfw80zmf3x-nixos-test-driver-timezone-static/test-script
Oh no! 💥 💔 💥
1 file would be reformatted.
builder for '/nix/store/q7dwy5fkiahdv9q65c17pzgh90aqxppj-nixos-test-driver-timezone-static.drv' failed with exit code 1
cannot build derivation '/nix/store/769fsp2qh581h181ffg09n6dlb0pxmn2-vm-test-run-timezone-static.drv': 1 dependencies couldn't be built
error: build of '/nix/store/769fsp2qh581h181ffg09n6dlb0pxmn2-vm-test-run-timezone-static.drv' failed
@@ -266,6 +266,7 @@ in | |||
taskserver = handleTest ./taskserver.nix {}; | |||
telegraf = handleTest ./telegraf.nix {}; | |||
tiddlywiki = handleTest ./tiddlywiki.nix {}; | |||
timezone = handleTest ./timezone.nix {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails to run:
⇒ nix-build -A nixosTests.timezone
error: attempt to call something which is not a function but a set, at /home/flokli/dev/nixos/nixpkgs-gitlab/nixos/tests/all-tests.nix:18:20
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@flokli try with the latest commit.
ping @x123 |
@flokli actually, I think I managed to fix it. |
There was a stray newline. Rebased on latest master and squashed. |
@GrahamcOfBorg test timezone |
Motivation for this change
Port
timezone
test to python for #72828Things done
Ported
timezone
test to python.sandbox
innix.conf
on non-NixOS linux)nixos/tests/timezone.nix
Notify maintainers
cc @lheckemann