goss-org / goss

Quick and Easy server testing/validation
https://goss.rocks
Apache License 2.0
5.55k stars 473 forks source link

Filetest reports success on missing files if goss doas not have sufficient access permission #457

Closed mtgxx closed 4 years ago

mtgxx commented 5 years ago

goss reports success if it not has sufficient rights.

$ goss --version
goss version v0.3.7
$ sudo install -o root -g root -m 0700 -d /tmp/tst
$ cat goss-perm.yaml 
file:
  /tmp/tst/test.txt:
    exists: true
    skip: false
$ goss -g goss-perm.yaml validate; echo $?
.

Total Duration: 0.001s
Count: 1, Failed: 0, Skipped: 0
0
$ sudo goss -g goss-perm.yaml validate
F

Failures/Skipped:

File: /tmp/tst/test.txt: exists:
Expected
    <bool>: false
to equal
    <bool>: true

Total Duration: 0.000s
Count: 1, Failed: 1, 

It should fail in both cases.

aelsabbahy commented 4 years ago

Thank you for reporting this, surprised no one ran into this sooner.

I've merged a fix, this will be in goss >0.3.9

I'll wait a week to see if any other features/fixes go into this release, if not.. I'll release with this one change.

Thanks again for your contribution!

aelsabbahy commented 4 years ago

released