Skip to content

Commit

Permalink
Remove .#ci.tests.run.integration from nix flake
Browse files Browse the repository at this point in the history
We no longer run integration tests by building a nix derivation — we run shell scripts from the `justfile` instead. This means that we no longer specify configuration variables for our integration tests in nix.
  • Loading branch information
HeinrichApfelmus committed Dec 18, 2024
1 parent c010fdb commit ea2252a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 90 deletions.
6 changes: 0 additions & 6 deletions docs/site/src/contributor/what/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ or more comfortably, for pre-configured networks (`mainnet`, `testnet`, ...):
> nix run .#mainnet/wallet -- <optional additional cardano wallet arguments>
```

You can run the integration tests with:

```console
> nix build -L .#ci.x86_64-linux.tests.run.integration
```

#### Cross-compiling with Nix

To build the wallet for Windows, from **Linux**:
Expand Down
62 changes: 13 additions & 49 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# - etc (layout is PACKAGE.COMPONENT)
# - checks - attrset of test-suite results
# - cardano-wallet.unit
# - cardano-wallet.integration
# - etc
# - benchmarks - attret of benchmark executables
# - cardano-wallet.db
Expand Down Expand Up @@ -49,6 +48,11 @@
# (Running an item will typically also build it if it has not been built
# in the nix store already.)
#
# 2024-12-18
# Running tests via `nix run` is *discouraged*.
# We use `nix` to produce the artifacts,
# but we try to no longer run checks on these artifacts
# by building a nix derivation (we still do that for unit tests).
#
# The CI-related outputs are
#
Expand All @@ -70,41 +74,10 @@
# - outputs.apps."<system>".ci.
# - tests
# - unit - run the unit tests on this system
# - integration - run the integration tests on this system
# - benchmarks
# - restore
# - …
#
# Recommended granularity:
#
# after each commit:
# on x86_64-linux:
# nix build .#ci.tests.all
# nix build .#ci.benchmarks.all
# nix build .#ci.artifacts.linux64.release
# nix build .#ci.artifacts.win64.release
# nix build .#ci.artifacts.win64.tests
#
# nix run .#ci.tests.unit
#
# before each pull request merge:
# on each supported system:
# nix build .#ci.benchmarks.all
# nix build .#ci.tests.all
#
# nix run .#ci.tests.unit
# nix run .#ci.tests.integration
#
# nightly:
# on x86_64-linux:
# nix build .#ci.artifacts.dockerImage
#
# nix run .#ci.benchmarks.restore
# nix run .#ci.benchmarks.…
#
# on x65_64-darwin: (macos)
# nix build .#ci.artifacts.win64.release
#
############################################################################

############################################################################
Expand Down Expand Up @@ -459,27 +432,18 @@
mkApp = name: pkg: {
type = "app";
program = pkg.exePath or "${pkg}/bin/${pkg.name or name}";
};
};
apps = lib.mapAttrs mkApp packages;

devShells = mkDevShells walletProject;

ci.tests.run.unit = pkgs.releaseTools.aggregate
{
name = "tests.run.unit";
meta.description = "Run unit tests";
constituents =
lib.collect lib.isDerivation
(lib.keepUnitChecks packages.checks);
};
ci.tests.run.integration = pkgs.releaseTools.aggregate
{
name = "tests.run.integration";
meta.description = "Run integration tests";
constituents =
lib.collect lib.isDerivation
(lib.keepIntegrationChecks packages.checks);
};
ci.tests.run.unit = pkgs.releaseTools.aggregate {
name = "tests.run.unit";
meta.description = "Run unit tests";
constituents =
lib.collect lib.isDerivation
(lib.keepUnitChecks packages.checks);
};
};

systems = eachSystem supportedSystems mkOutputs;
Expand Down
39 changes: 4 additions & 35 deletions nix/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -191,42 +191,11 @@ CHaP: haskell-nix: nixpkgs-recent: nodePkgs: haskell-nix.cabalProject' [
};

packages.cardano-wallet-integration.components.tests = {
# Running Windows integration tests under Wine is disabled
# because ouroboros-network doesn't fully work under Wine.
integration.doCheck = !pkgs.stdenv.hostPlatform.isWindows;

# Force more integration tests to run in parallel than the
# default number of build cores.
# NOTE:
# We are concerned with building integration test executables here,
# but we are no longer concerned with *running* the integration
# tests as part of building a nix derivation.
#
# To alleviate TimeInterpreter race conditions on the mac builders
# since #2755, we run slightly less in parallel on macOS.
integration.testFlags =
if pkgs.stdenv.hostPlatform.isDarwin
then [ "-j" "2" ]
else [ "-j" "3" ];

integration.preCheck = noCacheCookie + ''
# Variables picked up by integration tests
export CARDANO_NODE_TRACING_MIN_SEVERITY=notice
export TESTS_RETRY_FAILED=yes
export LOCAL_CLUSTER_CONFIGS=${localClusterConfigs}
# Integration tests will place logs here
export TESTS_LOGDIR=$(mktemp -d)/logs
'' + lib.optionalString stdenv.isDarwin ''
export TMPDIR=/tmp
'';

integration.postCheck = ''
# fixme: There needs to be some Haskell.nix changes to
# permit getting build products from failed builds.
if [ -n "$TESTS_LOGDIR" && -f $out/nix-support/failed ]; then
logfile=$out/cardano-wallet-integration-logs.tar.gz
${pkgs.buildPackages.gnutar}/bin/tar -C $(dirname $TESTS_LOGDIR) -czvf $logfile $TESTS_LOGDIR
echo "file none $logfile" >> $out/nix-support/hydra-build-products
fi
'';

# provide cardano-node & cardano-cli to tests
integration.build-tools = cardanoNodeExes;
};
Expand Down

0 comments on commit ea2252a

Please sign in to comment.