nixos/tests/ipget: init
Add a NixOS VM test for ipget.
This commit is contained in:
@@ -745,6 +745,7 @@ in
|
||||
invoiceplane = runTest ./invoiceplane.nix;
|
||||
iodine = runTest ./iodine.nix;
|
||||
iosched = runTest ./iosched.nix;
|
||||
ipget = runTest ./ipget.nix;
|
||||
ipv6 = runTest ./ipv6.nix;
|
||||
iscsi-multipath-root = runTest ./iscsi-multipath-root.nix;
|
||||
iscsi-root = runTest ./iscsi-root.nix;
|
||||
|
||||
28
nixos/tests/ipget.nix
Normal file
28
nixos/tests/ipget.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
name = "ipget";
|
||||
meta.maintainers = with lib.maintainers; [
|
||||
Luflosi
|
||||
];
|
||||
|
||||
nodes.machine =
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
services.kubo.enable = true;
|
||||
environment.systemPackages = with pkgs; [ ipget ];
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
with subtest("Add file to IPFS"):
|
||||
ipfs_hash = machine.succeed(
|
||||
"echo -n fnord | ipfs add --quieter"
|
||||
)
|
||||
|
||||
with subtest("Download the file with ipget"):
|
||||
machine.succeed(f"ipget --output file.txt /ipfs/{ipfs_hash}")
|
||||
contents = machine.succeed("cat file.txt")
|
||||
assert contents == "fnord", f"Unexpected file contents: {contents}"
|
||||
'';
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
lib,
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
nixosTests,
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
@@ -24,6 +25,10 @@ buildGoModule rec {
|
||||
|
||||
doCheck = false;
|
||||
|
||||
passthru.tests = {
|
||||
inherit (nixosTests) ipget;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Retrieve files over IPFS and save them locally";
|
||||
homepage = "https://ipfs.io/";
|
||||
|
||||
@@ -32,7 +32,7 @@ buildGoModule rec {
|
||||
subPackages = [ "cmd/ipfs" ];
|
||||
|
||||
passthru.tests = {
|
||||
inherit (nixosTests) kubo;
|
||||
inherit (nixosTests) kubo ipget;
|
||||
repoVersion = callPackage ./test-repoVersion.nix { };
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user