Skip to content
Snippets Groups Projects
spending.nix 1.08 KiB
Newer Older
{ pkgs, lib, ... }:
{
  name = "zkap-spending-service";
  nodes = {
    spending = { config, pkgs, ourpkgs, modulesPath, ... }: {
      imports = [
        ../modules/packages.nix
        ../modules/spending.nix
      ];

      services.private-storage-spending.enable = true;
      services.private-storage-spending.domain = "localhost";
    };
  };
  testScript = { nodes }: let
    revision = nodes.spending.config.passthru.ourpkgs.zkap-spending-service.meta.rev;
    curl = "${pkgs.curl}/bin/curl -sSf";
  in
    ''
      import json

      start_all()

      spending.wait_for_open_port(80)
      with subtest("Ensure we can ping the spending service"):
        output = spending.succeed("${curl} http://localhost/v1/_ping")
        assert json.loads(output)["status"] == "ok", "Could not ping spending service."
      with subtest("Ensure that the spending service version matches the expected version"):
        output = spending.succeed("${curl} http://localhost/v1/_version")
        assert json.loads(output)["revision"] == "${revision}", "Spending service revision does not match."
    '';
}