Skip to content

Commit

Permalink
Merge #2018
Browse files Browse the repository at this point in the history
2018: nix fixes + edgeNode test fixes. r=jbgi a=jbgi



Co-authored-by: Jean-Baptiste Giraudeau <jean-baptiste.giraudeau@iohk.io>
  • Loading branch information
iohk-bors[bot] and jbgi committed Oct 27, 2020
2 parents a67c1c6 + a30c0ed commit 30fcd19
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 726 deletions.
4 changes: 2 additions & 2 deletions default.nix
Expand Up @@ -24,9 +24,9 @@ let

scripts = callPackage ./nix/scripts.nix { inherit customConfig; };
# NixOS tests run a proxy and validate it listens
nixosTests = import ./nix/nixos/tests {
nixosTests = recRecurseIntoAttrs (import ./nix/nixos/tests {
inherit pkgs;
};
});

dockerImage = let
defaultConfig = rec {
Expand Down
35 changes: 20 additions & 15 deletions nix/haskell.nix
Expand Up @@ -26,7 +26,7 @@ let
projectPackages = lib.attrNames (haskell-nix.haskellLib.selectProjectPackages
(haskell-nix.cabalProject {
inherit src;
compiler-nix-name = "ghc8102";
compiler-nix-name = compiler;
}));

# This creates the Haskell package set.
Expand Down Expand Up @@ -64,18 +64,23 @@ let
lib.mkForce [buildPackages.jq buildPackages.coreutils buildPackages.shellcheck];
}
{
# Stamp executables with the git revision
# And make sure that libsodium DLLs are available for windows binaries:
# make sure that libsodium DLLs are available for windows binaries:
packages = lib.genAttrs projectPackages (name: {
postInstall = ''
if [ -d $out/bin ]; then
${setGitRev}
${lib.optionalString stdenv.hostPlatform.isWindows
"ln -s ${libsodium}/bin/libsodium-23.dll $out/bin/libsodium-23.dll"
}
fi
'';
});
postInstall = lib.optionalString stdenv.hostPlatform.isWindows ''
if [ -d $out/bin ]; then
${setLibSodium}
fi
'';
});
}
{
# Stamp executables with the git revision
packages = lib.genAttrs ["cardano-node" "cardano-cli"] (name: {
components.exes.${name}.postInstall = ''
${lib.optionalString stdenv.hostPlatform.isWindows setLibSodium}
${setGitRev}
'';
});
}
({ pkgs, config, ... }: {
# Packages we wish to ignore version bounds of.
Expand Down Expand Up @@ -153,9 +158,9 @@ let
# setGitRev is a postInstall script to stamp executables with
# version info. It uses the "gitrev" argument, if set. Otherwise,
# the revision is sourced from the local git work tree.
setGitRev = ''
${haskellBuildUtils}/bin/set-git-rev "${gitrev'}" $out/bin/* || true
'';
setGitRev = ''${haskellBuildUtils}/bin/set-git-rev "${gitrev'}" $out/bin/*'';
# package with libsodium:
setLibSodium = "ln -s ${libsodium}/bin/libsodium-23.dll $out/bin/libsodium-23.dll";
gitrev' = if (gitrev == null)
then buildPackages.commonLib.commitIdFromGitRepoOrZero ../.git
else gitrev;
Expand Down
40 changes: 31 additions & 9 deletions nix/nixos/tests/cardano-node-edge.nix
Expand Up @@ -3,25 +3,47 @@ with pkgs;
{
name = "cardano-node-edge-test";
nodes = {
machine = { config, pkgs, ... }: {
nixpkgs.overlays = commonLib.overlays;
machine = { config, ... }: {
nixpkgs.pkgs = pkgs;
imports = [
../.
];
services.cardano-node = {
enable = true;
systemdSocketActivation = true;
port = 3001;
inherit (commonLib.environments.staging) genesisFile genesisHash;
topology = commonLib.mkEdgeTopology {};
hostAddr = "127.0.0.1";
environment = "mainnet";
cardanoNodePkgs = pkgs;
nodeConfig = config.services.cardano-node.environments.${config.services.cardano-node.environment}.nodeConfig // {
hasPrometheus = [ config.services.cardano-node.hostAddr 12798 ];
# Use Journald output:
setupScribes = [{
scKind = "JournalSK";
scName = "cardano";
scFormat = "ScText";
}];
defaultScribes = [
[
"JournalSK"
"cardano"
]
];
};
};
systemd.services.cardano-node.serviceConfig.Restart = lib.mkForce "no";
};
};
testScript = ''
startAll
$machine->waitForUnit("cardano-node.service");
$machine->waitForOpenPort(3001);
$machine->succeed("stat /run/cardano-node");
$machine->succeed("stat /run/cardano-node/node-core-0.socket");
start_all()
machine.wait_for_unit("cardano-node.service")
machine.sleep(5)
machine.succeed("systemctl status cardano-node")
machine.succeed("stat /run/cardano-node")
machine.succeed("stat /run/cardano-node/node.socket")
machine.sleep(15)
machine.succeed("nc -z 127.0.0.1 12798")
machine.succeed("nc -z 127.0.0.1 3001")
'';

}
107 changes: 0 additions & 107 deletions nix/nixos/tests/chairmans-cluster.nix

This file was deleted.

7 changes: 2 additions & 5 deletions nix/nixos/tests/default.nix
Expand Up @@ -9,15 +9,12 @@ with pkgs.commonLib;
forAllSystems = genAttrs supportedSystems;
importTest = fn: args: system: let
imported = import fn;
test = import (pkgs.path + "/nixos/tests/make-test.nix") imported;
test = import (pkgs.path + "/nixos/tests/make-test-python.nix") imported;
in test ({
inherit pkgs system config;
} // args);
callTest = fn: args: forAllSystems (system: hydraJob (importTest fn args system));
in rec {
# only tests that port is open since the test can't access network to actually sync
# cardanoNodeEdge = callTest ./cardano-node-edge.nix {};

# Subsumes what cardanoNodeEdge does
chairmansCluster = callTest ./chairmans-cluster.nix {};
cardanoNodeEdge = callTest ./cardano-node-edge.nix {};
}
1 change: 1 addition & 0 deletions nix/scripts.nix
Expand Up @@ -10,6 +10,7 @@ let
};
systemdCompat.options = {
systemd.services = mkOption {};
systemd.sockets = lib.mkOption {};
assertions = [];
users = mkOption {};
};
Expand Down
1 change: 1 addition & 0 deletions nix/supervisord-cluster/default.nix
Expand Up @@ -39,6 +39,7 @@ let
mkStartScript = envConfig: let
systemdCompat.options = {
systemd.services = lib.mkOption {};
systemd.sockets = lib.mkOption {};
users = lib.mkOption {};
assertions = lib.mkOption {};
};
Expand Down
1 change: 1 addition & 0 deletions nix/supervisord-cluster/hfc/default.nix
Expand Up @@ -14,6 +14,7 @@ let
mkStartScript = envConfig: let
systemdCompat.options = {
systemd.services = lib.mkOption {};
systemd.sockets = lib.mkOption {};
users = lib.mkOption {};
assertions = lib.mkOption {};
};
Expand Down
1 change: 1 addition & 0 deletions nix/svclib.nix
Expand Up @@ -260,6 +260,7 @@ let
};
systemdCompat.options = {
systemd.services = mkOption {};
systemd.sockets = lib.mkOption {};
assertions = [];
users = mkOption {};
};
Expand Down
3 changes: 1 addition & 2 deletions release.nix
Expand Up @@ -77,8 +77,6 @@ let
};
};
extraBuilds = {
# only build nixos tests on first supported system (linux)
inherit (pkgsFor (builtins.head supportedSystems));
# Environments listed in Network Configuration page
cardano-deployment = pkgs.iohkNix.cardanoLib.mkConfigHtml { inherit (pkgs.iohkNix.cardanoLib.environments) mainnet testnet; };
} // (builtins.listToAttrs (map makeRelease [
Expand Down Expand Up @@ -155,6 +153,7 @@ let
};
}) // extraBuilds // (mkRequiredJob (concatLists [
(collectJobs jobs.native.checks)
(collectJobs jobs.native.nixosTests)
(collectJobs jobs.native.benchmarks)
(collectJobs jobs.native.exes)
(optional windowsBuild jobs.cardano-node-win64)
Expand Down
62 changes: 0 additions & 62 deletions scripts/chairmans-cluster/README.org

This file was deleted.

0 comments on commit 30fcd19

Please sign in to comment.