Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find and rm only the relevant files when a test fails #360

Closed
joshrabinowitz opened this issue Feb 20, 2019 · 4 comments
Closed

find and rm only the relevant files when a test fails #360

joshrabinowitz opened this issue Feb 20, 2019 · 4 comments

Comments

@joshrabinowitz
Copy link
Collaborator

As mentioned in #334 , when tests fail users might see a long string of find errors, such as:

not ok 28 run 'hide' from inside subdirectory
# (in test file /home/joshr/gitsrc/git-secret/tests/test_hide.bats, line 88)
#   `[ "$status" -eq 0 ]' failed
# rm: cannot remove ‘space file’: No such file or directory
# fatal: Not a git repository: '.git'
# find: ‘/tmp/tmp.aBlVDAbUQF’: Permission denied
# find: ‘/tmp/systemd-private-8b7dddc415874f87ad46f53ff94b4d7f-rtkit-daemon.service-KNfvrc’: Permission denied
# find: ‘/tmp/systemd-private-8b7dddc415874f87ad46f53ff94b4d7f-colord.service-ivZa8u’: Permission denied
# find: ‘/tmp/systemd-private-8b7dddc415874f87ad46f53ff94b4d7f-fwupd.service-07aFP3’: Permission denied
# find: ‘/tmp/tmp.UbZvBTtYAa’: Permission denied
# find: ‘/tmp/systemd-private-8b7dddc415874f87ad46f53ff94b4d7f-chronyd.service-G1ov1r’: Permission denied
# find: ‘/tmp/systemd-private-8b7dddc415874f87ad46f53ff94b4d7f-cups.service-kAx3OS’: Permission denied
# find: ‘/tmp/systemd-private-8b7dddc415874f87ad46f53ff94b4d7f-bolt.service-IZaN9N’: Permission denied
# find: ‘/tmp/tmp.1L9d7x7l3I’: Permission denied

This shouldn't happen. See also #333

@Mohjive
Copy link
Contributor

Mohjive commented Mar 4, 2019

It would be easy to add a 2>/dev/null at the end of the find | xargs rm command in function _find_and_clean at line ~442 in src/_utils/_git_secret_tools.sh to hide all such warnings. It would also hide error output from normal operation. The verbose output would still print. Is this an OK solution?

@joshrabinowitz
Copy link
Collaborator Author

joshrabinowitz commented Mar 4, 2019

No let's not do that.

If a test fails, we should not try to 'rm' files in /tmp that had nothing to do with our code

@joshrabinowitz joshrabinowitz changed the title don't emit find errors on dev environments when tests fail find and rm only the relevant files when a test fails Mar 4, 2019
@joshrabinowitz
Copy link
Collaborator Author

joshrabinowitz commented Apr 1, 2019

@joshrabinowitz
Copy link
Collaborator Author

Fixed by #473

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants