about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMarek Mahut <marek.mahut@gmail.com>2019-08-25 19:54:03 +0200
committerGitHub <noreply@github.com>2019-08-25 19:54:03 +0200
commit18dfe1a3f5114872e00a019e2a339286ed649f82 (patch)
tree926e19b9ce92cf12afc674c0a445dda344bb4a40 /nixos
parentbba3f5f14464628b50fa582705f7d394b3c40f97 (diff)
parent1a6d3f5bc25a1cd8879f25d1086aa63eb810d4ff (diff)
downloadnixlib-18dfe1a3f5114872e00a019e2a339286ed649f82.tar
nixlib-18dfe1a3f5114872e00a019e2a339286ed649f82.tar.gz
nixlib-18dfe1a3f5114872e00a019e2a339286ed649f82.tar.bz2
nixlib-18dfe1a3f5114872e00a019e2a339286ed649f82.tar.lz
nixlib-18dfe1a3f5114872e00a019e2a339286ed649f82.tar.xz
nixlib-18dfe1a3f5114872e00a019e2a339286ed649f82.tar.zst
nixlib-18dfe1a3f5114872e00a019e2a339286ed649f82.zip
Merge pull request #67449 from mmahut/jormungandr
nixos/jormungandr: adding genesis tests
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/networking/jormungandr.nix2
-rw-r--r--nixos/tests/jormungandr.nix28
2 files changed, 29 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/jormungandr.nix b/nixos/modules/services/networking/jormungandr.nix
index c1a16a316b7a..0c66b85fe8a5 100644
--- a/nixos/modules/services/networking/jormungandr.nix
+++ b/nixos/modules/services/networking/jormungandr.nix
@@ -13,7 +13,7 @@ let
   configSettings = {
     storage = dataDir;
     p2p = {
-      public_address = "/ip4/127.0.0.1/tcp/8606";
+      public_address = "/ip4/127.0.0.1/tcp/8299";
       messages = "high";
       blocks = "high";
     };
diff --git a/nixos/tests/jormungandr.nix b/nixos/tests/jormungandr.nix
index ab4edf0506aa..2abafc53ce51 100644
--- a/nixos/tests/jormungandr.nix
+++ b/nixos/tests/jormungandr.nix
@@ -5,9 +5,17 @@ import ./make-test.nix ({ pkgs, ... }: {
   };
 
   nodes = {
+    # Testing the Byzantine Fault Tolerant protocol
     bft = { ... }: {
       environment.systemPackages = [ pkgs.jormungandr ];
+      services.jormungandr.enable = true;
+      services.jormungandr.genesisBlockFile = "/var/lib/jormungandr/block-0.bin";
+      services.jormungandr.secretFile = "/etc/secrets/jormungandr.yaml";
+    };
 
+    # Testing the Ouroboros Genesis Praos protocol
+    genesis = { ... }: {
+      environment.systemPackages = [ pkgs.jormungandr ];
       services.jormungandr.enable = true;
       services.jormungandr.genesisBlockFile = "/var/lib/jormungandr/block-0.bin";
       services.jormungandr.secretFile = "/etc/secrets/jormungandr.yaml";
@@ -17,6 +25,7 @@ import ./make-test.nix ({ pkgs, ... }: {
   testScript = ''
     startAll;
 
+    ## Testing BFT
     # Let's wait for the StateDirectory
     $bft->waitForFile("/var/lib/jormungandr/");
 
@@ -45,5 +54,24 @@ import ./make-test.nix ({ pkgs, ... }: {
 
     # Now we can test if we are able to reach the REST API
     $bft->waitUntilSucceeds("curl -L http://localhost:8607/api/v0/node/stats | grep uptime");
+
+    ## Testing Genesis
+    # Let's wait for the StateDirectory
+    $genesis->waitForFile("/var/lib/jormungandr/");
+
+    # Bootstraping the configuration
+    $genesis->succeed("jormungandr-bootstrap -g -p 8607 -s 1");
+
+    # Moving generated files in place
+    $genesis->succeed("mkdir -p /etc/secrets");
+    $genesis->succeed("mv pool-secret1.yaml /etc/secrets/jormungandr.yaml");
+    $genesis->succeed("mv block-0.bin /var/lib/jormungandr/");
+
+    # We should have everything to start the service now
+    $genesis->succeed("systemctl restart jormungandr");
+    $genesis->waitForUnit("jormungandr.service");
+
+    # Now we can create and delegate an account
+    $genesis->succeed("./create-account-and-delegate.sh | tee -a /tmp/delegate.log");
   '';
 })