From 4196aa9660a3168ef28dd783a0fff4e11695506e Mon Sep 17 00:00:00 2001 From: Tim Steinbach Date: Wed, 25 Nov 2020 13:00:41 -0500 Subject: [PATCH] awscli: Add test --- nixos/tests/all-tests.nix | 1 + nixos/tests/awscli.nix | 17 +++++++++++++++++ pkgs/tools/admin/awscli/default.nix | 7 ++++++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/awscli.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 899509696e3c..771ee9bdbd33 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -28,6 +28,7 @@ in atd = handleTest ./atd.nix {}; avahi = handleTest ./avahi.nix {}; avahi-with-resolved = handleTest ./avahi.nix { networkd = true; }; + awscli = handleTest ./awscli.nix { }; babeld = handleTest ./babeld.nix {}; bazarr = handleTest ./bazarr.nix {}; bcachefs = handleTestOn ["x86_64-linux"] ./bcachefs.nix {}; # linux-4.18.2018.10.12 is unsupported on aarch64 diff --git a/nixos/tests/awscli.nix b/nixos/tests/awscli.nix new file mode 100644 index 000000000000..35bdd6d99b1a --- /dev/null +++ b/nixos/tests/awscli.nix @@ -0,0 +1,17 @@ +import ./make-test-python.nix ({ pkgs, ...} : { + name = "awscli"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ nequissimus ]; + }; + + machine = { pkgs, ... }: + { + environment.systemPackages = [ pkgs.awscli ]; + }; + + testScript = + '' + assert "${pkgs.python3Packages.botocore.version}" in machine.succeed("aws --version") + assert "${pkgs.awscli.version}" in machine.succeed("aws --version") + ''; +}) diff --git a/pkgs/tools/admin/awscli/default.nix b/pkgs/tools/admin/awscli/default.nix index bb7575118da6..8bf242561b1c 100644 --- a/pkgs/tools/admin/awscli/default.nix +++ b/pkgs/tools/admin/awscli/default.nix @@ -1,4 +1,5 @@ { lib +, nixosTests , python3 , groff , less @@ -64,7 +65,11 @@ in with py.pkgs; buildPythonApplication rec { rm $out/bin/aws.cmd ''; - passthru.python = py; # for aws_shell + passthru = { + python = py; # for aws_shell + + tests = { inherit (nixosTests) awscli; }; + }; meta = with lib; { homepage = "https://aws.amazon.com/cli/";