From edec1515faebddedb0677690f84b66efc3faabfb Mon Sep 17 00:00:00 2001 From: Samuel Leathers Date: Fri, 10 Aug 2018 09:46:38 -0400 Subject: [PATCH] [DEVOPS-980] Fix log collection in integration test --- default.nix | 2 +- .../test/wallet/integration/build-test.nix | 33 ++++++++++--------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/default.nix b/default.nix index 761f5afec69..a4e3aac26cf 100644 --- a/default.nix +++ b/default.nix @@ -136,7 +136,7 @@ let shellcheck = pkgs.callPackage ./scripts/test/shellcheck.nix { inherit src; }; hlint = pkgs.callPackage ./scripts/test/hlint.nix { inherit src; }; stylishHaskell = pkgs.callPackage ./scripts/test/stylish.nix { inherit (cardanoPkgs) stylish-haskell; inherit src localLib; }; - walletIntegration = pkgs.callPackage ./scripts/test/wallet/integration/build-test.nix { inherit walletIntegrationTests pkgs; }; + walletIntegration = pkgs.callPackage ./scripts/test/wallet/integration/build-test.nix { inherit walletIntegrationTests; }; swaggerSchemaValidation = pkgs.callPackage ./scripts/test/wallet/swaggerSchemaValidation.nix { inherit gitrev; }; }; cardano-sl-explorer-frontend = (import ./explorer/frontend { diff --git a/scripts/test/wallet/integration/build-test.nix b/scripts/test/wallet/integration/build-test.nix index e4339113652..55082976145 100644 --- a/scripts/test/wallet/integration/build-test.nix +++ b/scripts/test/wallet/integration/build-test.nix @@ -1,17 +1,18 @@ -{pkgs, stdenv, walletIntegrationTests, glibcLocales }: -stdenv.mkDerivation rec { - name = "cardano-wallet-integration-tests"; - buildInputs = with pkgs; [ jq curl glibcLocales ]; - buildCommand = '' - ${walletIntegrationTests} - EXIT_CODE=$? - mkdir -pv $out/nix-support - if [ $EXIT_CODE != 0 ] - then - touch $out/nix-support/failed - tar -czvf $out/logs.tar.gz state-demo/logs - echo "file binary-dist $out/logs.tar.gz" >> $out/nix-support/hydra-build-products - fi - ''; - +{stdenv, jq, curl, runCommand, walletIntegrationTests, glibcLocales }: +runCommand "cardano-wallet-integration-tests" { + buildInputs = [ jq curl glibcLocales ]; } +'' + #!${stdenv.shell} + function capture_logs { + echo "The build failed with exit code $?" + mkdir -pv $out/nix-support + touch $out/nix-support/failed + tar -czvf $out/logs.tar.gz state-demo/logs + echo "file binary-dist $out/logs.tar.gz" >> $out/nix-support/hydra-build-products + exit 0 + } + ${walletIntegrationTests} || capture_logs + touch $out + exit 0 +''