From 4f7eab6de1fb2c3abee2b0fd7cc503752f60270a Mon Sep 17 00:00:00 2001 From: Anthony Roussel Date: Wed, 25 Oct 2023 11:29:11 +0200 Subject: [PATCH] nixosTests.amazon-ssm-agent: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/amazon-ssm-agent.nix | 17 +++++++++++++++++ pkgs/by-name/am/amazon-ssm-agent/package.nix | 12 ++++++++---- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 nixos/tests/amazon-ssm-agent.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index f44fcfcf54ab..a0796721e80e 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -117,6 +117,7 @@ in { allTerminfo = handleTest ./all-terminfo.nix {}; alps = handleTest ./alps.nix {}; amazon-init-shell = handleTest ./amazon-init-shell.nix {}; + amazon-ssm-agent = handleTest ./amazon-ssm-agent.nix {}; amd-sev = runTest ./amd-sev.nix; anbox = runTest ./anbox.nix; anuko-time-tracker = handleTest ./anuko-time-tracker.nix {}; diff --git a/nixos/tests/amazon-ssm-agent.nix b/nixos/tests/amazon-ssm-agent.nix new file mode 100644 index 000000000000..957e9e0e02c5 --- /dev/null +++ b/nixos/tests/amazon-ssm-agent.nix @@ -0,0 +1,17 @@ +import ./make-test-python.nix ({ lib, pkgs, ... }: { + name = "amazon-ssm-agent"; + meta.maintainers = [ lib.maintainers.anthonyroussel ]; + + nodes.machine = { config, pkgs, ... }: { + services.amazon-ssm-agent.enable = true; + }; + + testScript = '' + start_all() + + machine.wait_for_file("/etc/amazon/ssm/seelog.xml") + machine.wait_for_file("/etc/amazon/ssm/amazon-ssm-agent.json") + + machine.wait_for_unit("amazon-ssm-agent.service") + ''; +}) diff --git a/pkgs/by-name/am/amazon-ssm-agent/package.nix b/pkgs/by-name/am/amazon-ssm-agent/package.nix index 4816ac1bdc73..4de3ee4f53b1 100644 --- a/pkgs/by-name/am/amazon-ssm-agent/package.nix +++ b/pkgs/by-name/am/amazon-ssm-agent/package.nix @@ -10,6 +10,7 @@ , dmidecode , bashInteractive , nix-update-script +, nixosTests , testers , amazon-ssm-agent , overrideEtc ? true @@ -136,11 +137,14 @@ buildGoModule rec { ''; passthru = { - updateScript = nix-update-script { }; - tests.version = testers.testVersion { - package = amazon-ssm-agent; - command = "amazon-ssm-agent --version"; + tests = { + inherit (nixosTests) amazon-ssm-agent; + version = testers.testVersion { + package = amazon-ssm-agent; + command = "amazon-ssm-agent --version"; + }; }; + updateScript = nix-update-script { }; }; meta = with lib; {