From 1bbd4180131dbb45c59c441c14ce596a9037e0a0 Mon Sep 17 00:00:00 2001 From: David Houston Date: Thu, 20 Jan 2022 11:35:23 -0500 Subject: [PATCH 1/3] nixos/quorum: Patch test to not run indefinitely As written, the nixos/quorum module will simply run forever, and has been timing out in Hydra. Implement a fix for such by changing the final statement from a wait_until_succeeds to simply succeed, forcing the test to succeed or fail instead of run indefinitely. --- nixos/tests/quorum.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nixos/tests/quorum.nix b/nixos/tests/quorum.nix index 498b55ace7af..ed659f54bf48 100644 --- a/nixos/tests/quorum.nix +++ b/nixos/tests/quorum.nix @@ -72,8 +72,6 @@ import ./make-test-python.nix ({ pkgs, ... }: { machine.wait_until_succeeds("systemctl restart quorum") machine.wait_for_unit("quorum.service") machine.sleep(15) - machine.wait_until_succeeds( - 'geth attach /var/lib/quorum/geth.ipc --exec "eth.accounts" | grep 0x9377bc3936de934c497e22917b81aa8774ac3bb0' - ) + machine.succeed('geth attach /var/lib/quorum/geth.ipc --exec "eth.accounts" | grep 0x9377bc3936de934c497e22917b81aa8774ac3bb0') ''; }) From a7c72013c8816f769f387c2e6d5ff76d801d145d Mon Sep 17 00:00:00 2001 From: Patrick Hilhorst Date: Thu, 20 Jan 2022 19:58:19 +0100 Subject: [PATCH 2/3] nixosTests.quorum: use less opaque strings and more nix objects --- nixos/tests/quorum.nix | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/nixos/tests/quorum.nix b/nixos/tests/quorum.nix index ed659f54bf48..64c1c76e402d 100644 --- a/nixos/tests/quorum.nix +++ b/nixos/tests/quorum.nix @@ -1,4 +1,29 @@ -import ./make-test-python.nix ({ pkgs, ... }: { +import ./make-test-python.nix ({ pkgs, ... }: +let + keystore = { + address = "9377bc3936de934c497e22917b81aa8774ac3bb0"; + crypto = { + cipher = "aes-128-ctr"; + ciphertext = "ad8341d8ef225650403fd366c955f41095e438dd966a3c84b3d406818c1e366c"; + cipherparams = { + iv = "2a09f7a72fd6dff7c43150ff437e6ac2"; + }; + kdf = "scrypt"; + kdfparams = { + dklen = 32; + n = 262144; + p = 1; + r = 8; + salt = "d1a153845bb80cd6274c87c5bac8ac09fdfac5ff131a6f41b5ed319667f12027"; + }; + mac = "a9621ad88fa1d042acca6fc2fcd711f7e05bfbadea3f30f379235570c8e270d3"; + }; + id = "89e847a3-1527-42f6-a321-77de0a14ce02"; + version = 3; + }; + keystore-file = pkgs.writeText "keystore-file" (builtins.toJSON keystore); +in +{ name = "quorum"; meta = with pkgs.lib.maintainers; { maintainers = [ mmahut ]; @@ -64,7 +89,7 @@ import ./make-test-python.nix ({ pkgs, ... }: { start_all() machine.wait_until_succeeds("mkdir -p /var/lib/quorum/keystore") machine.wait_until_succeeds( - 'echo \{\\"address\\":\\"9377bc3936de934c497e22917b81aa8774ac3bb0\\",\\"crypto\\":\{\\"cipher\\":\\"aes-128-ctr\\",\\"ciphertext\\":\\"ad8341d8ef225650403fd366c955f41095e438dd966a3c84b3d406818c1e366c\\",\\"cipherparams\\":\{\\"iv\\":\\"2a09f7a72fd6dff7c43150ff437e6ac2\\"\},\\"kdf\\":\\"scrypt\\",\\"kdfparams\\":\{\\"dklen\\":32,\\"n\\":262144,\\"p\\":1,\\"r\\":8,\\"salt\\":\\"d1a153845bb80cd6274c87c5bac8ac09fdfac5ff131a6f41b5ed319667f12027\\"\},\\"mac\\":\\"a9621ad88fa1d042acca6fc2fcd711f7e05bfbadea3f30f379235570c8e270d3\\"\},\\"id\\":\\"89e847a3-1527-42f6-a321-77de0a14ce02\\",\\"version\\":3\}\\" > /var/lib/quorum/keystore/UTC--2020-03-23T11-08-34.144812212Z--9377bc3936de934c497e22917b81aa8774ac3bb0' + 'cp ${keystore-file} /var/lib/quorum/keystore/UTC--2020-03-23T11-08-34.144812212Z--${keystore.address}' ) machine.wait_until_succeeds( "echo fe2725c4e8f7617764b845e8d939a65c664e7956eb47ed7d934573f16488efc1 > /var/lib/quorum/nodekey" @@ -72,6 +97,6 @@ import ./make-test-python.nix ({ pkgs, ... }: { machine.wait_until_succeeds("systemctl restart quorum") machine.wait_for_unit("quorum.service") machine.sleep(15) - machine.succeed('geth attach /var/lib/quorum/geth.ipc --exec "eth.accounts" | grep 0x9377bc3936de934c497e22917b81aa8774ac3bb0') + machine.succeed('geth attach /var/lib/quorum/geth.ipc --exec "eth.accounts" | grep ${keystore.address}') ''; }) From ffccc4c558bcf0739e8b8df9109753af4702041f Mon Sep 17 00:00:00 2001 From: Patrick Hilhorst Date: Thu, 20 Jan 2022 19:58:42 +0100 Subject: [PATCH 3/3] nixosTests.quorum: use succeed everywhere --- nixos/tests/quorum.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/tests/quorum.nix b/nixos/tests/quorum.nix index 64c1c76e402d..31669eb7fc38 100644 --- a/nixos/tests/quorum.nix +++ b/nixos/tests/quorum.nix @@ -87,14 +87,14 @@ in testScript = '' start_all() - machine.wait_until_succeeds("mkdir -p /var/lib/quorum/keystore") - machine.wait_until_succeeds( + machine.succeed("mkdir -p /var/lib/quorum/keystore") + machine.succeed( 'cp ${keystore-file} /var/lib/quorum/keystore/UTC--2020-03-23T11-08-34.144812212Z--${keystore.address}' ) - machine.wait_until_succeeds( + machine.succeed( "echo fe2725c4e8f7617764b845e8d939a65c664e7956eb47ed7d934573f16488efc1 > /var/lib/quorum/nodekey" ) - machine.wait_until_succeeds("systemctl restart quorum") + machine.succeed("systemctl restart quorum") machine.wait_for_unit("quorum.service") machine.sleep(15) machine.succeed('geth attach /var/lib/quorum/geth.ipc --exec "eth.accounts" | grep ${keystore.address}')