Skip to content

nixos/tests/timezone: port to python#74858

Merged
flokli merged 1 commit intoNixOS:masterfrom
x123:x123-test-timezone-python
Dec 5, 2019
Merged

nixos/tests/timezone: port to python#74858
flokli merged 1 commit intoNixOS:masterfrom
x123:x123-test-timezone-python

Conversation

@x123
Copy link
Copy Markdown
Contributor

@x123 x123 commented Dec 2, 2019

Motivation for this change

Port timezone test to python for #72828

Things done

Ported timezone test to python.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) nixos/tests/timezone.nix
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @lheckemann

@ofborg ofborg bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Dec 2, 2019
@flokli
Copy link
Copy Markdown
Member

flokli commented Dec 2, 2019

Can you add this test to nixos/tests/all-tests.nix?

@x123
Copy link
Copy Markdown
Contributor Author

x123 commented Dec 2, 2019

@flokli yep, done.

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tfc done

@flokli
Copy link
Copy Markdown
Member

flokli commented Dec 4, 2019

@GrahamcOfBorg test timezone

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Contributor Author

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.

@flokli
Copy link
Copy Markdown
Member

flokli commented Dec 4, 2019

ping @x123

@flokli flokli added the 9.needs: clean-up Somebody please clean up this mess! label Dec 4, 2019
@x123
Copy link
Copy Markdown
Contributor Author

x123 commented Dec 5, 2019

@flokli actually, I think I managed to fix it.

@flokli
Copy link
Copy Markdown
Member

flokli commented Dec 5, 2019

There was a stray newline. Rebased on latest master and squashed.

@flokli
Copy link
Copy Markdown
Member

flokli commented Dec 5, 2019

@GrahamcOfBorg test timezone

@flokli flokli merged commit a6391cf into NixOS:master Dec 5, 2019
@x123 x123 deleted the x123-test-timezone-python branch December 6, 2019 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 9.needs: clean-up Somebody please clean up this mess! 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants