forked from mirrors/nixpkgs
nixos/prometheus-lnd-exporter: fix test
The bitcoin module options have changed, reflect this. Also switch to regtest which is more suitable for testing.
This commit is contained in:
parent
39331740f8
commit
eab071ae54
|
@ -454,15 +454,21 @@ let
|
||||||
enable = true;
|
enable = true;
|
||||||
lndTlsPath = "/var/lib/lnd/tls.cert";
|
lndTlsPath = "/var/lib/lnd/tls.cert";
|
||||||
lndMacaroonDir = "/var/lib/lnd";
|
lndMacaroonDir = "/var/lib/lnd";
|
||||||
|
extraFlags = [ "--lnd.network=regtest" ];
|
||||||
};
|
};
|
||||||
metricProvider = {
|
metricProvider = {
|
||||||
systemd.services.prometheus-lnd-exporter.serviceConfig.DynamicUser = false;
|
virtualisation.memorySize = 1024;
|
||||||
services.bitcoind.main.enable = true;
|
systemd.services.prometheus-lnd-exporter.serviceConfig.RestartSec = 15;
|
||||||
services.bitcoind.main.extraConfig = ''
|
systemd.services.prometheus-lnd-exporter.after = [ "lnd.service" ];
|
||||||
rpcauth=bitcoinrpc:e8fe33f797e698ac258c16c8d7aadfbe$872bdb8f4d787367c26bcfd75e6c23c4f19d44a69f5d1ad329e5adf3f82710f7
|
services.bitcoind.regtest = {
|
||||||
bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332
|
enable = true;
|
||||||
bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333
|
extraConfig = ''
|
||||||
'';
|
rpcauth=bitcoinrpc:e8fe33f797e698ac258c16c8d7aadfbe$872bdb8f4d787367c26bcfd75e6c23c4f19d44a69f5d1ad329e5adf3f82710f7
|
||||||
|
zmqpubrawblock=tcp://127.0.0.1:28332
|
||||||
|
zmqpubrawtx=tcp://127.0.0.1:28333
|
||||||
|
'';
|
||||||
|
extraCmdlineOptions = [ "-regtest" ];
|
||||||
|
};
|
||||||
systemd.services.lnd = {
|
systemd.services.lnd = {
|
||||||
serviceConfig.ExecStart = ''
|
serviceConfig.ExecStart = ''
|
||||||
${pkgs.lnd}/bin/lnd \
|
${pkgs.lnd}/bin/lnd \
|
||||||
|
@ -471,7 +477,7 @@ let
|
||||||
--tlskeypath=/var/lib/lnd/tls.key \
|
--tlskeypath=/var/lib/lnd/tls.key \
|
||||||
--logdir=/var/log/lnd \
|
--logdir=/var/log/lnd \
|
||||||
--bitcoin.active \
|
--bitcoin.active \
|
||||||
--bitcoin.mainnet \
|
--bitcoin.regtest \
|
||||||
--bitcoin.node=bitcoind \
|
--bitcoin.node=bitcoind \
|
||||||
--bitcoind.rpcuser=bitcoinrpc \
|
--bitcoind.rpcuser=bitcoinrpc \
|
||||||
--bitcoind.rpcpass=hunter2 \
|
--bitcoind.rpcpass=hunter2 \
|
||||||
|
@ -483,13 +489,31 @@ let
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
};
|
};
|
||||||
|
# initialize wallet, creates macaroon needed by exporter
|
||||||
|
systemd.services.lnd.postStart = ''
|
||||||
|
${pkgs.curl}/bin/curl \
|
||||||
|
--retry 20 \
|
||||||
|
--retry-delay 1 \
|
||||||
|
--retry-connrefused \
|
||||||
|
--cacert /var/lib/lnd/tls.cert \
|
||||||
|
-X GET \
|
||||||
|
https://localhost:8080/v1/genseed | ${pkgs.jq}/bin/jq -c '.cipher_seed_mnemonic' > /tmp/seed
|
||||||
|
${pkgs.curl}/bin/curl \
|
||||||
|
--retry 20 \
|
||||||
|
--retry-delay 1 \
|
||||||
|
--retry-connrefused \
|
||||||
|
--cacert /var/lib/lnd/tls.cert \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"wallet_password\": \"asdfasdfasdf\", \"cipher_seed_mnemonic\": $(cat /tmp/seed | tr -d '\n')}" \
|
||||||
|
https://localhost:8080/v1/initwallet
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
exporterTest = ''
|
exporterTest = ''
|
||||||
wait_for_unit("lnd.service")
|
wait_for_unit("lnd.service")
|
||||||
wait_for_open_port(10009)
|
wait_for_open_port(10009)
|
||||||
wait_for_unit("prometheus-lnd-exporter.service")
|
wait_for_unit("prometheus-lnd-exporter.service")
|
||||||
wait_for_open_port(9092)
|
wait_for_open_port(9092)
|
||||||
succeed("curl -sSf localhost:9092/metrics | grep '^promhttp_metric_handler'")
|
succeed("curl -sSf localhost:9092/metrics | grep '^lnd_peer_count'")
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue