nixpkgs/pkgs/applications/networking/jmeter/default.nix
Bryan A. S c48a355030 jmeter: 5.1.1 > 5.4
Update Jmeter to the latest version, also add myself as a maintainer

I have been using the package for 5 months daily, at the moment I am aware of 3 bugs.

1. Jmeter fails to save test plan in /nix/store (by default it saves it where Jmeter was installed).

2. The test fails to run on the latest version complaining about some missing libraries, for example log4j.

3. Jmeter fails to generate the report from a JTL file, for some reason it is not copying the needed files sometimes it fails without any log or error.

The rest works perfectly, but I still plan to fix it at somepoint, as I only use it for development, I didn't find any other bugs, and in the case of the report generator it is possible to generate it during the test run (in my case, the test is run on a non-NIXOS machine) or in a container.

Also add why tests are disabled.

Signed-off-by: Bryan A. S <bryanasdev000@gmail.com>
2021-01-18 01:01:26 -03:00

61 lines
2.0 KiB
Nix

{ fetchurl, lib, stdenv, jre, makeWrapper, coreutils }:
stdenv.mkDerivation rec {
pname = "jmeter";
version = "5.4";
src = fetchurl {
url = "https://archive.apache.org/dist/jmeter/binaries/apache-${pname}-${version}.tgz";
sha256 = "1hbyvh0hrvfvrsf7wpnwqsry5gaziac632s0bwb5zbq6y5b0z41a";
};
nativeBuildInputs = [ makeWrapper jre ];
installPhase = ''
mkdir $out
rm bin/*.bat bin/*.cmd
cp -R * $out/
substituteInPlace $out/bin/create-rmi-keystore.sh --replace \
"keytool -genkey" \
"${jre}/lib/openjdk/jre/bin/keytool -genkey"
# Prefix some scripts with jmeter to avoid clobbering the namespace
for i in heapdump.sh mirror-server mirror-server.sh shutdown.sh stoptest.sh create-rmi-keystore.sh; do
mv $out/bin/$i $out/bin/jmeter-$i
wrapProgram $out/bin/jmeter-$i \
--prefix PATH : "${jre}/bin"
done
wrapProgram $out/bin/jmeter --set JAVA_HOME "${jre}"
wrapProgram $out/bin/jmeter.sh --set JAVA_HOME "${jre}"
'';
doInstallCheck = false; #NoClassDefFoundError: org/apache/logging/log4j/Level for tests
checkInputs = [ coreutils ];
installCheckPhase = ''
$out/bin/jmeter --version 2>&1 | grep -q "${version}"
$out/bin/jmeter-heapdump.sh > /dev/null
$out/bin/jmeter-shutdown.sh > /dev/null
$out/bin/jmeter-stoptest.sh > /dev/null
timeout --kill=1s 1s $out/bin/jmeter-mirror-server.sh || test "$?" = "124"
'';
meta = with lib; {
description = "A 100% pure Java desktop application designed to load test functional behavior and measure performance";
longDescription = ''
The Apache JMeter desktop application is open source software, a 100%
pure Java application designed to load test functional behavior and
measure performance. It was originally designed for testing Web
Applications but has since expanded to other test functions.
'';
license = licenses.asl20;
maintainers = [ maintainers.bryanasdev000 ];
priority = 1;
platforms = platforms.unix;
};
}