Merge pull request #265652 from brokenpip3/update-bats-file-add-bats-detik

feat(bats): bats-libs add pre/postinstall hook and use finalAttrs, update bats-file to 0.4.0 and add bats-detik
This commit is contained in:
Pol Dellaiera 2023-11-29 09:40:27 +01:00 committed by GitHub
commit 789f7281f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 14 deletions

View file

@ -2673,6 +2673,13 @@
githubId = 1071610;
name = "Gunnar Nitsche";
};
brokenpip3 = {
email = "brokenpip3@gmail.com";
matrix = "@brokenpip3:matrix.org";
github = "brokenpip3";
githubId = 40476330;
name = "brokenpip3";
};
bryanasdev000 = {
email = "bryanasdev000@gmail.com";
matrix = "@bryanasdev000:matrix.org";

View file

@ -140,6 +140,7 @@ resholve.mkDerivation rec {
bats_load_library bats-support
bats_load_library bats-assert
bats_load_library bats-file
bats_load_library bats-detik/detik.bash
bats_require_minimum_version 1.5.0
@ -170,7 +171,7 @@ resholve.mkDerivation rec {
'';
passAsFile = [ "testScript" ];
} ''
${bats.withLibraries (p: [ p.bats-support p.bats-assert p.bats-file ])}/bin/bats "$testScriptPath"
${bats.withLibraries (p: [ p.bats-support p.bats-assert p.bats-file p.bats-detik ])}/bin/bats "$testScriptPath"
touch "$out"
'';

View file

@ -1,18 +1,20 @@
{ lib, stdenv, fetchFromGitHub }: {
bats-assert = stdenv.mkDerivation rec {
bats-assert = stdenv.mkDerivation (finalAttrs: {
pname = "bats-assert";
version = "2.1.0";
src = fetchFromGitHub {
owner = "bats-core";
repo = "bats-assert";
rev = "v${version}";
sha256 = "sha256-opgyrkqTwtnn/lUjMebbLfS/3sbI2axSusWd5i/5wm4=";
rev = "v${finalAttrs.version}";
hash = "sha256-opgyrkqTwtnn/lUjMebbLfS/3sbI2axSusWd5i/5wm4=";
};
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p "$out/share/bats/bats-assert"
cp load.bash "$out/share/bats/bats-assert"
cp -r src "$out/share/bats/bats-assert"
runHook postInstall
'';
meta = {
description = "Common assertions for Bats";
@ -21,22 +23,24 @@
license = lib.licenses.cc0;
maintainers = with lib.maintainers; [ infinisil ];
};
};
});
bats-file = stdenv.mkDerivation rec {
bats-file = stdenv.mkDerivation (finalAttrs: {
pname = "bats-file";
version = "0.3.0";
version = "0.4.0";
src = fetchFromGitHub {
owner = "bats-core";
repo = "bats-file";
rev = "v${version}";
sha256 = "sha256-3xevy0QpwNZrEe+2IJq58tKyxQzYx8cz6dD2nz7fYUM=";
rev = "v${finalAttrs.version}";
hash = "sha256-NJzpu1fGAw8zxRKFU2awiFM2Z3Va5WONAD2Nusgrf4o=";
};
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p "$out/share/bats/bats-file"
cp load.bash "$out/share/bats/bats-file"
cp -r src "$out/share/bats/bats-file"
runHook postInstall
'';
meta = {
description = "Common filesystem assertions for Bats";
@ -45,22 +49,49 @@
license = lib.licenses.cc0;
maintainers = with lib.maintainers; [ infinisil ];
};
};
});
bats-support = stdenv.mkDerivation rec {
bats-detik = stdenv.mkDerivation (finalAttrs: {
pname = "bats-detik";
version = "1.2.1";
src = fetchFromGitHub {
owner = "bats-core";
repo = "bats-detik";
rev = "v${finalAttrs.version}";
hash = "sha256-2BEIqRSc21oPjd9BgTLg5mGyAdNJYA2b7gZe7Nj2dks=";
};
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p "$out/share/bats/bats-detik"
cp -r lib/* "$out/share/bats/bats-detik"
runHook postInstall
'';
meta = {
description = "Library to ease e2e tests of applications in K8s environments";
platforms = lib.platforms.all;
homepage = "https://github.com/bats-core/bats-detik";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ brokenpip3 ];
};
});
bats-support = stdenv.mkDerivation (finalAttrs: {
pname = "bats-support";
version = "0.3.0";
src = fetchFromGitHub {
owner = "bats-core";
repo = "bats-support";
rev = "v${version}";
sha256 = "sha256-4N7XJS5XOKxMCXNC7ef9halhRpg79kUqDuRnKcrxoeo=";
rev = "v${finalAttrs.version}";
hash = "sha256-4N7XJS5XOKxMCXNC7ef9halhRpg79kUqDuRnKcrxoeo=";
};
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p "$out/share/bats/bats-support"
cp load.bash "$out/share/bats/bats-support"
cp -r src "$out/share/bats/bats-support"
runHook postInstall
'';
meta = {
description = "Supporting library for Bats test helpers";
@ -69,5 +100,5 @@
license = lib.licenses.cc0;
maintainers = with lib.maintainers; [ infinisil ];
};
};
});
}