Skip to content

Commit c0d02bc

Browse files
committed
feat: run impure tests as Hercules CI effects
1 parent f35cc13 commit c0d02bc

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

ci/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
imports = [
88
inputs.hercules-ci-effects.flakeModule
99
"${inputs.hercules-ci-effects}/effects/push-cache/default.nix"
10+
./impure-tests.nix
1011
];
1112
config = {
1213
hercules-ci.github-pages.branch = "master";

ci/impure-tests.nix

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
withSystem,
3+
config,
4+
...
5+
}: {
6+
# TODO map over all tests and add impure oens as effects
7+
8+
herculesCI.onPush.default.outputs.effects.testing-cardano-node = withSystem config.defaultEffectSystem ({
9+
hci-effects,
10+
config,
11+
...
12+
}:
13+
hci-effects.modularEffect {
14+
extraAttributes.__hci_effect_mounts."/dev/kvm" = "kvm";
15+
effectScript = ''
16+
${(config.cardanoNix._mkCheckFromTest config.cardanoNix.tests.cardano-node).driver}/bin/nixos-test-driver
17+
'';
18+
});
19+
}

tests/cardano-node.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
nodes = {
1111
machine = {pkgs, ...}: {
1212
virtualisation = {
13-
cores = 2;
13+
cores = 1;
1414
memorySize = 1024;
1515
};
1616
cardanoNix = {
@@ -27,7 +27,7 @@
2727

2828
testScript = ''
2929
machine.wait_for_unit("cardano-node")
30-
machine.wait_until_succeeds("""[[ $(echo "$(cardano-cli query tip --testnet-magic 2 | jq '.syncProgress' --raw-output) > 1" | bc) == "1" ]]""")
30+
machine.wait_until_succeeds("""[[ $(echo "$(cardano-cli query tip --testnet-magic 2 | jq '.syncProgress' --raw-output) > 0.01" | bc) == "1" ]]""")
3131
'';
3232
};
3333
};

0 commit comments

Comments
 (0)