Skip to content

Commit

Permalink
refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ibizaman committed Jan 27, 2025
1 parent 9129a1b commit a40c7ad
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions tests/networking-hosts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
'';
Expand Down

0 comments on commit a40c7ad

Please sign in to comment.