about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/toxiproxy/default.nix
blob: 22dd5d2f6eeba874f8f199a58566f72edb7b6869 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{ lib
, buildGoModule
, fetchFromGitHub
, testers
, toxiproxy
}:

buildGoModule rec {
  pname = "toxiproxy";
  version = "2.9.0";

  src = fetchFromGitHub {
    owner = "Shopify";
    repo = "toxiproxy";
    rev = "v${version}";
    sha256 = "sha256-zwKeJ8LMMSSHvE0x0/9j3wBdAJG43RiGcszKz0B3dG8=";
  };

  vendorHash = "sha256-eSQvLsSWWypA5vXR/GiEf5j7TzzsL8ZFRPOeICsIrlY=";

  excludedPackages = [ "test/e2e" ];

  ldflags = [ "-s" "-w" "-X github.com/Shopify/toxiproxy/v2.Version=${version}" ];

  # Fixes tests on Darwin
  __darwinAllowLocalNetworking = true;

  checkFlags = [
    "-short"
    "-skip=TestVersionEndpointReturnsVersion|TestFullstreamLatencyBiasDown"
  ];

  postInstall = ''
    mv $out/bin/cli $out/bin/toxiproxy-cli
    mv $out/bin/server $out/bin/toxiproxy-server
  '';

  passthru.tests = {
    cliVersion = testers.testVersion {
      inherit version;
      package = toxiproxy;
      command = "${toxiproxy}/bin/toxiproxy-cli -version";
    };
    serverVersion = testers.testVersion {
      inherit version;
      package = toxiproxy;
      command = "${toxiproxy}/bin/toxiproxy-server -version";
    };
  };

  meta = {
    changelog = "https://github.com/Shopify/toxiproxy/releases/tag/v${version}";
    description = "Proxy for for simulating network conditions";
    homepage = "https://github.com/Shopify/toxiproxy";
    maintainers = with lib.maintainers; [ avnik ];
    license = lib.licenses.mit;
  };
}