From a40c7ad6799724cf3d3c6f6ddacfd6e6be0a22ab Mon Sep 17 00:00:00 2001 From: ibizaman Date: Thu, 5 Dec 2024 16:23:33 +0100 Subject: [PATCH] refactor tests --- tests/networking-hosts.nix | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tests/networking-hosts.nix b/tests/networking-hosts.nix index e16813f22..f9edd6550 100644 --- a/tests/networking-hosts.nix +++ b/tests/networking-hosts.nix @@ -11,24 +11,16 @@ file=${config.out}/etc/hosts - if [[ ! $(grep '127.0.0.1' $file | head -n1) =~ localhost$ ]]; then - cat $file - echo "'$(grep '127.0.0.1' $file | head -n1)'" + if ! grep '127.0.0.1' $file | head -n1 | grep localhost$; then exit 1 fi - if [[ ! $(grep '127.0.0.1' $file | tail -n1) =~ my.super.host$ ]]; then - cat $file - echo "'$(grep '127.0.0.1' $file | tail -n1)'" + if ! grep '127.0.0.1' $file | tail -n1 | grep my.super.host$; then exit 2 fi - if [[ ! $(grep '::1' $file) =~ localhost$ ]]; then - cat $file - echo "'$(grep '::1' $file)'" + if ! grep '::1' $file | grep localhost$; then exit 3 fi - if [[ ! $(grep '10.0.0.1' $file) =~ my.super.host\ my.other.host$ ]]; then - cat $file - echo "'$(grep '10.0.0.1' $file)'" + if ! grep '10.0.0.1' $file | grep my.super.host\ my.other.host$; then exit 4 fi '';