nfengine icon indicating copy to clipboard operation
nfengine copied to clipboard

Add automatic resource cleanup to FileSystem and File tests

Open lookeypl opened this issue 9 years ago • 4 comments

Some tests related to FileSystem and File (ex. FileSystemTest::TouchFile) create a file during the test. In case of failure, the file will stay and future test calls will fail earlier because the test file already exists. Investigate all possible places where such thing might happen and implement a solution to fix it. Probably a FileRAII might be a good idea here - see what will be the best for these tests.

lookeypl avatar Aug 12 '15 09:08 lookeypl

Maybe just put all test files in some "TestData" folder and modify python script so it's always removed after running the tests?

Witek902 avatar Aug 12 '15 13:08 Witek902

This should be done by tests themself, not by the test script. Someone can call "Bin/x64/Release/nfCommonTest.exe" directly (I do that sometimes) and then nothing will remove the files.

lookeypl avatar Aug 13 '15 08:08 lookeypl

Can't You put them into folder and overload gtest's TearDown() to delete the folder recursively, if it exists?

mkulagowski avatar Aug 13 '15 11:08 mkulagowski

@mkulagowski it is one of the solutions. Assignee will have to do the investigation and choose what is best for our tests. ;)

lookeypl avatar Aug 18 '15 08:08 lookeypl