From bf97703f0e160307cc9318029b05a028e95f6ce3 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Fri, 14 Apr 2023 02:43:41 +0200 Subject: [PATCH] nixos/tests/kubo: clean up code - Use `runTest` instead of `handleTest`, which simplifies the code a little - Use `lib.maintainers` instead of `pkgs.lib.maintainers` - Use `ipfs add --quieter` instead of `ipfs add | awk '{ print $2 }'` - Whitespace and comment changes --- nixos/tests/all-tests.nix | 2 +- nixos/tests/kubo.nix | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 2ad1ec35022a..201dc3d72b50 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -359,7 +359,7 @@ in { ksm = handleTest ./ksm.nix {}; kthxbye = handleTest ./kthxbye.nix {}; kubernetes = handleTestOn ["x86_64-linux"] ./kubernetes {}; - kubo = handleTest ./kubo.nix {}; + kubo = runTest ./kubo.nix; ladybird = handleTest ./ladybird.nix {}; languagetool = handleTest ./languagetool.nix {}; latestKernel.login = handleTest ./login.nix { latestKernel = true; }; diff --git a/nixos/tests/kubo.nix b/nixos/tests/kubo.nix index 4f6bc0ef1cfa..08468e31bf77 100644 --- a/nixos/tests/kubo.nix +++ b/nixos/tests/kubo.nix @@ -1,6 +1,6 @@ -import ./make-test-python.nix ({ pkgs, ...} : { +{ lib, ...} : { name = "kubo"; - meta = with pkgs.lib.maintainers; { + meta = with lib.maintainers; { maintainers = [ mguentner Luflosi ]; }; @@ -25,21 +25,18 @@ import ./make-test-python.nix ({ pkgs, ...} : { testScript = '' start_all() - # IPv4 activation - + # IPv4 socket activation machine.succeed("ipfs --api /ip4/127.0.0.1/tcp/2324 id") ipfs_hash = machine.succeed( - "echo fnord | ipfs --api /ip4/127.0.0.1/tcp/2324 add | awk '{ print $2 }'" + "echo fnord | ipfs --api /ip4/127.0.0.1/tcp/2324 add --quieter" ) - machine.succeed(f"ipfs cat /ipfs/{ipfs_hash.strip()} | grep fnord") - # Unix domain socket activation - machine.stop_job("ipfs") + # Unix domain socket activation ipfs_hash = machine.succeed( - "echo fnord2 | ipfs --api /unix/run/ipfs.sock add | awk '{ print $2 }'" + "echo fnord2 | ipfs --api /unix/run/ipfs.sock add --quieter" ) machine.succeed( f"ipfs --api /unix/run/ipfs.sock cat /ipfs/{ipfs_hash.strip()} | grep fnord2" @@ -66,4 +63,4 @@ import ./make-test-python.nix ({ pkgs, ...} : { fuse.succeed(f"cat /ipfs/{ipfs_hash} | grep fnord3") ''; -}) +}