Testing can destroy your home

Feb 7, 2013 at 1:55 PM
Hello and thank you for your hard work.

I was wondering if it's a good idea to always perform "rm -rf *" in the OnInit() method in the test cases?

I was testing the SCP upload and didn't notice it has deleted everything in my home directory. I think you can test upload/download of a file without having to wipe every document, foto and directories from the target disk. I know I'm responsible for executing someone else's code on my machine, but I lost a day of work.

At least put a warning there somewhere!

Thanks and regards
Feb 7, 2013 at 3:42 PM

Sorry about that.
I build those test to run against my test machine which is dedicated for this purpose and I never expected anybody to run it on the server other then test or at least with the username that is not for test.
Unfortunately currently I am not aware of any other way to do it, other then tracking files that I create, but then I always can have an issue of test failing in the middle and created files never will be deleted.
I also don't know where should I put a warning for that.

Feb 7, 2013 at 5:14 PM
Edited Feb 7, 2013 at 5:15 PM
Hi again,

How about creating and using a special ssh.net subdirectory for testing purposes? then it can be disposed at will with rm -rf.

Or having the test files containing a special pattern in their name, then in OnInit() you could find them and delete them with "find . -type f -name *.your_pattern -print | xargs rm".

I guess it's rather improbable that people will use a dedicated machine just for tests, or that they will setup special accounts only for this, but that's my opinion and I cannot speak for all.

Thanks and best regards!
Feb 7, 2013 at 7:12 PM
I can look into putting it into different folder probably.
Well, originally I was not planning for anybody to use those test except for developers
So I guess next time I am looking at test I will do those changes.
If yo don't mine, can you open it as a Issue so I don't forget about it?

Feb 7, 2013 at 7:33 PM
I have created an issue.

Thanks Oleg and best regards!