2024-04-21 15:54:59 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, testers
|
|
|
|
, toxiproxy
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
buildGoModule rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "toxiproxy";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "2.9.0";
|
2022-06-16 17:23:12 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Shopify";
|
|
|
|
repo = "toxiproxy";
|
|
|
|
rev = "v${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
sha256 = "sha256-zwKeJ8LMMSSHvE0x0/9j3wBdAJG43RiGcszKz0B3dG8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
vendorHash = "sha256-eSQvLsSWWypA5vXR/GiEf5j7TzzsL8ZFRPOeICsIrlY=";
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
excludedPackages = [ "test/e2e" ];
|
|
|
|
|
|
|
|
ldflags = [ "-s" "-w" "-X github.com/Shopify/toxiproxy/v2.Version=${version}" ];
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
# Fixes tests on Darwin
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
checkFlags = [
|
|
|
|
"-short"
|
|
|
|
"-skip=TestVersionEndpointReturnsVersion|TestFullstreamLatencyBiasDown"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
2020-05-15 21:57:56 +00:00
|
|
|
mv $out/bin/cli $out/bin/toxiproxy-cli
|
2022-06-16 17:23:12 +00:00
|
|
|
mv $out/bin/server $out/bin/toxiproxy-server
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
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";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
2024-04-21 15:54:59 +00:00
|
|
|
changelog = "https://github.com/Shopify/toxiproxy/releases/tag/v${version}";
|
2020-10-19 00:13:06 +00:00
|
|
|
description = "Proxy for for simulating network conditions";
|
2022-06-16 17:23:12 +00:00
|
|
|
homepage = "https://github.com/Shopify/toxiproxy";
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with lib.maintainers; [ avnik ];
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
};
|
|
|
|
}
|